Possible Duplicate:
Is it possible to create an “uber” jar containing the project classes and the project dependencies as jars with a custom manifest file?
我正在考虑多平台部署。在 Perl 和 Python 等语言中,总是令人沮丧的关键事情之一是部署第三方库和第二方库。
我想知道 java 构建过程是否允许将程序使用的所有非 JRE 库打包到 jar 中,以便可以将其部署到任何地方,而无需安装到任何其他目录中。
最佳答案
不,jar 文件不应包含其他 jar 文件。可以这样做,但只能使用使一切变得更加复杂的自定义类加载器。为什么不将 jar 及其所有依赖项压缩在一起:
myApp.zip
|_bin
| |_ start.bat
| |_ start.sh
|
|_lib
|_myApp.jar
|_other.jar
|_other2.jar
关于Java Jar包: do/can they include all non-JDK libraries?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12942073/