back

Java

Creating a single-jar java app

If you want your java app to be deployed as a single jar containing your classes and all the third party libs, you basically need your build process to unjar all third party libs into a temporary directory together with your classes and then jar it all back together again.

This zip-file contains a tiny Hello World project showing how it could be done using apache ant. It also shows how to set up your manifest in order to call your java app like this:

java -jar myApp.jar

2010 update: check https://code.google.com/p/jarjar/: an ant task that seems to do what we want.

Enumerate Classes in Classpath

This class by Kris Dover can be used to obtain a list of all classes in a classpath.
I'm posting This file here since the original location (https://lappy.gotdns.com/drupal/files/ClassList.java) has expired.


back