简体   繁体   中英

Eclipse Java; export jar, include referenced libraries, without fatjar

I need to export jar from my Eclipse Java project and I want to include the referenced libraries. I can't use fatjar for this, which is what everyone seems to recommend. There must be another way of doing this. Does anyone know what this is?!

The next version of Eclipse (3.5, due next June) has an option to include all necessary jars. It was introduced in 3.5M5 (thanks, basszero ).

Or you can try to build your project with Maven 2 . Then, you can build a "fat" jar with mvn assembly:assembly .

Another option is to use ant . Unpack all JAR files into a temp directory and jar them up again.

I think its version 3.3 of Eclipse (ganymede) that has Export as Runnable JAR file . Last time I tried it, it did include the referenced libraries and also un-jars all the jars.

This feature of eclipse works just fine to dump only the referenced libraries into separate folder. "Export as Runnable Jar" with "Copy the referenced libraries into a subfolder .." option.

只是发布了一个使用Eclipse导出Jar的小(Helios)问题 - 你必须首先运行(在Eclipse中)一个带有main()方法的类,否则“启动配置”下拉列表将是空白的,你将无法出口。

I guess you could modify your build script to include the libraries. If I undestand correctly you can put into your <jar destfile="myProject.jar"> ... <zipfileset src="theExternalLib.jar"> </jar>

您可以从eclipse导出XML文件,然后分析该文件以获得所需的jar文件 - 请参阅链接。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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