I have recently revisited an earlier project of mine which embedded a compressed version of an executable JAR into a "stub" loader JAR which decompressed the embedded JAR at runtime giving the same functionality of the original JAR.
I updated it to use LZMA compression and to use pack200. This made a significant impact on JAR size!
As a logical extension to this tool I have created an Installer tool ( LzInstaller ) which when given an input zip file containing the project to create the installer for, will iterate over all files in the zip file adding to an internal data file. If a encounted file is a JAR it will re-pack it with pack200. Once the data file is created, it is added to a JAR with a "stub" installer loader. This installer JAR is then compressed using the LZMA embedded JAR tool mentioned earlier to give fantastic results!
The latest version of the Embedded JAR tool (lzEmbedder) can be found here
The latest version of the Installer tool (lzInstaller) can be found here
The source code for both tools can be found here
Feel free to use the code / tool in any way you like
To use high compression options you will need to increase the maximum heap size. Heap size during decompression is not effected greatly by compression option so you should not need to increase heap size when running the output JAR
An example of the performance of the tool:
Lobo - Java Web Browser (website
uncompressed - 11.83 MB
official installer - 7.93 MB
zip file - 7.26 MB (7-zip Ultra compression option )
lzInstall version -1.84 MB
-updated links to recent versions.