I've just uploaded a first release of tinyjar to github.
It takes a runnable jar and emits a much smaller runnable jar. For my current project, CODENAME GUJ:
- guj-maven-shade.jar: 14MB
- guj-maven-shade-minimised.jar: 7MB
- guj-tiny.jar: 2.8MB
Noting that maven-shade-minimised.jar doesn't start (as it deletes half of Spring, as it can't see it's needed as it's only accessed via. reflection), this is an 80% reduction. Not bad. It should work for any runnable jar.
TinyJar works by running the jar through pack200, then through LZMA. Neither are new technologies, but they are rather slow, even during unpacking. It adds at least a few seconds to application start as it unpacks the application to the temporary directory.
I thought this would be simpler than using a one-jar-style jar-in-jar classloader.. on the stream coming out of the decompressor.. in some way.. etc.