开发者

java library inside jar

I have created mytest.jar file with library that contains near 30 library files also jar. Is it possib开发者_运维问答le to put all library jars inside mytest.jar so that I need to distribute only 1 jar? May be it can be done using manifest? Thanks.


Loading classes from jars-inside-jars is not possible with the standard Java classloader. However it is possible using a custom classloader, this is how for example UberJar works.

The maven shade plugin takes a different approach. It will unpack all the jars you depend on, and pack them (along with your own classes) into one big jar. Then the normal classloader can be used. This is simpler, and is also possible without maven using jarjar.


Not out of the box. However, One-Jar provides a solution. It works fine for standalone apps, which is what I assume you' re making.

If you're making an applet instead, One-Jar won't work.


Usually one uses a jar repacking tool like jarjar for this purpose.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜