Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Building ClassPath variable in Manifest file with Eclipse

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

like image 627
stevebot Avatar asked Dec 13 '10 18:12

stevebot


1 Answers

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.

like image 191
mhaller Avatar answered Oct 06 '22 01:10

mhaller