[英]Java export jar including libraries
I have been looking around for some time now, but didn't a find way how to export a JAR
(not runnable jar
) that contains in it's build path the referenced libraries. 我已经寻找了一段时间,但是没有找到如何导出在其构建路径中包含所引用库的
JAR
(非runnable jar
)的方法。
Using Eclipse
, I have included the lib
folder which contains the jars of the referenced libraries in the export process. 使用
Eclipse
,我在导出过程中包括了lib
文件夹,其中包含引用库的jar。
Importing that JAR to another project and calling some method results in a ClassNotFoundException
. 将那个JAR导入另一个项目并调用一些方法会导致
ClassNotFoundException
。
Looking at the MANIFEST, I didn't see any reference to those jars in the classpath, though the jars are indeed included in the jar. 看着清单,我没有在类路径中看到对这些jar的任何引用,尽管jar确实包含在jar中。
So my questions are: 所以我的问题是:
1. Is there any way to accomplish the packaging of the non-executable JAR so it will include libraries? 1.有什么方法可以完成对非可执行JAR的打包,因此它将包含库?
2. Is there any best practice for building and deploying a jar that include other jars libraries? 2.是否有构建和部署包含其他jar库的jar的最佳实践?
I tried it too but it doesn't work for me. 我也尝试过,但是对我不起作用。 I added the final
.jar
file but it doesn't work. 我添加了最终的
.jar
文件,但是它不起作用。
So, I did a workaround. 因此,我做了一个解决方法。
.jar
file that you want as a dependency. .jar
文件作为依赖项。 .jar
file. .jar
文件中。 .jar
file as dependency inside an eclipse project. .jar
文件添加为eclipse项目内的依赖项。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.