简体   繁体   English

如何使用嵌套的JAR库生成java库?

[英]How to make java library with nested JAR libs?

I need save my application, that included external JAR libraries, in single JAR file for future use as single lib. 我需要将我的应用程序(包括外部JAR库)保存在单个JAR文件中,以备将来用作单个lib。 When I export it to JAR file, all nested jars append to archive, but not work as part of single lib. 当我将其导出到JAR文件时,所有嵌套的jar都附加到存档,但不能作为单个lib的一部分工作。 What I do wrong? 我做错了什么?

How can I make nested libraries private for external application? 如何将嵌套库专用于外部应用程序?

I think jars in a jar is not supported. 我认为罐子里的罐子不受支持。 But you can always extract the external JAR libraries and than create a jar containing their content and your classes in one jar. 但是你总是可以提取外部JAR库,而不是在一个jar中创建一个包含其内容和类的jar。

This way you can also remove the parts of the external libraries, you don't need, to reduce the size of the jar you create. 这样,您也可以删除外部库的部分,而不需要,以减小您创建的jar的大小。

Single Executable jar with all dependency nested is not possible by standard jar making process. 标准的jar制作过程无法实现具有所有依赖嵌套的单个可执行jar。 Alternatively you can place all dependent jars in a folder parallel to your own executable jar. 或者,您可以将所有相关的jar放在与您自己的可执行jar平行的文件夹中。

There is another way to create Single Jar with all nested dependent jar with the help of One-Jar . One-Jar的帮助下,还有另一种方法可以创建具有所有嵌套依赖jar的Single Jar I personally never tried this. 我个人从未尝试过这个。

Hope this helps. 希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM