There is a project that is started by the java -cp ".:lib.jar" Main
command java -cp ".:lib.jar" Main
. How can I get it in the jar (without unpacking lib.jar) so that this jar file can be executed?
1 answer
For these purposes, you can try one-jar , there is a plugin under maven
and ant
.
If you do not want to use third-party solutions, you can try to implement the ClassLoader
, which will be able to load classes from internal jar archives.
- How does the jar build generally occur in real projects that use many different libraries? - jisecayeyo
- Connect dependencies through the build program, then it collects the jar. As a result, the artifact already contains those classes that are necessary for the program. - Artem Konovalov
- Are they contained there unpacked or in jar? - jisecayeyo
|