Wednesday, March 4, 2009

Reduce a JNLP application size

I've found (with suggestions from my friend Matteo Croce) a simple and easy way to drastically reduce the size of Java client application:

  • pack all your classes and relative dependencies into a single jar using maven-shade-plugin (http://maven.apache.org/plugins/maven-shade-plugin/) or other similar ways
  • use Proguard (http://proguard.sourceforge.net/) to include into your uber-jar only those classes really used into your application (OPTIONAL)
  • Use standard Java 5 additional compression method Pack200 (http://java.sun.com/j2se/1.5.0/docs/guide/deployment/deployment-guide/pack200.html)
You can reduce an uber jar of 10 MB to 0,5 MB without many problems !!!

No comments: