Eclipse - Export jar with including libraries

I have a tiny problem… I want to export an eclipse project as a jar but:

  • I don’t want to use ‘Jar File’ as I can’t extract library jars into the exported jar
  • I don’t want to use ‘Runnable Jar File’ as I can’t select which files a do and don’t want and I can’t choose a manifest

Is there a way to somehow use both? Or do I have to use an external program?

Use Ant to do whatever you want, it’s more flexible and it can be used in Eclipse.

I don’t know the best answer. Ant is quite cool, but I’ve only made use of it in a limited way, kind of cook-book plugging into existing examples. It seems like a very useful tool, and have only been held back by the learning curve and my tendency to forget how to work with things I don’t use often, and the Eclipse tools work for 98% of what I need to do (so far).

Here are two additional suggestions:
(1) Eclipse has a responsive forum for questions.


I’ve always had good luck at the Newcomers area. Please do post the answer here if you get it solved at that site!

(2) JarSplice is quick to download and easy to use and can very likely handle your issue.
http://ninjacave.com/jarsplice
I was initially resisting going here, but was very pleasantly surprised when I finally gave it a try.

@gouessej, can ant include files from other jar files?

Yes, you can use a “fileset”, a “zipfileset” or a “zipgroupfileset” with an include filter for example. You can find some examples of use (fat JAR) here:
http://forum.jogamp.org/Fat-jar-deployment-method-ant-recipe-td4032213.html