File this one under “spend a few minutes Googling without success!”
If you’re trying to package up a Java application into one JAR file for easy deployment – including all dependency JAR files – there aren’t many options.
There’s a plugin for Eclipse called “Fat Jar” which I haven’t tried out. I’ve just discovered a tool called One-Jar, which does the trick. It’s simple to use. In my case, using Ant, it was a matter of:
- Download the One-Jar JAR file.
- Run it (using
java -jar) to extract the contents
- Add the one jar ant task plugin .jar file to my ant lib folder
- Import the
one-jar-ant-task.xmlbuild file into my build file
- Create a
manifest.mffile with the
- Add in the
<one-jar>task to my existing build.xml file as per the instructions.
- And you’re done!
The ant task does a lot of the work…
View original post 24 more words