Building ClassPath variable in Manifest file with Eclipse

这一生的挚爱 提交于 2019-12-22 04:43:53

问题


Is there a way for Eclipse to output all the Jars I would like to define on my ClassPath variable in the Manifest when exporting a project as a jar? I would like to be able to just click on all the jars I need my project to depend on, and then have Eclipse output it all like:

ClassPath: . /lib/somejar.jar /lib/otherjar.jar

Thanks


回答1:


Yes, there is:

Eclipse > File > Export > Java > Runnable JAR File > "Copy required libraries into a sub-folder next to the generated JAR".

It will create a MANIFEST.MF with all the classpath entries of your Java project. You need to have a working launch configuration.

Do not use "Package required libraries", as it will create a nasty Jar-In-Jar-ResourceLoader class into your jar file. You usually don't want such things in there.

Btw, did you try Maven? It does that for you automatically. Every time. On all platforms. On all IDEs. Independently of your Eclipse version. It does that also on your build server when you're on holiday.



来源:https://stackoverflow.com/questions/4432440/building-classpath-variable-in-manifest-file-with-eclipse

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!