Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to strip down JVM to get the smallest install possible?

I have a Java app to deploy and want to deploy the JVM along with it (to simplify install). I want to have the JVM stripped down to only include the pieces the app needs to keep the distributable small. How can I strip down the JVM to bring the size down? Can this be done with the Java Kernel or is there some alternative to the Sun JVM that is a much smaller install? My target platform is Windows.

like image 354
Jeremy Raymond Avatar asked Dec 07 '09 00:12

Jeremy Raymond


2 Answers

I think your requirements are mixed up: deploying the JVM with an app simplifies your job because you don't have to worry about JVM versions - but can be a considerable annoyance to users who don't want to have dozens of JVMs installed just to make programmers' jobs easier. Shouldn't you worry about that just as much as about distribution sizes?

I'd say that the best you can do is to use the Deployment Toolkit JavaScript to deploy your application via Java WebStart and specify a Java Kernel install. This makes sure a new JVM is installed only when actually required. The rest of the time it doesn't have to install anything except your app - the best possible case.

like image 183
Michael Borgwardt Avatar answered Sep 22 '22 21:09

Michael Borgwardt


Here's three ideas:

  • Use GCJ to compile your application to machine code, then add what parts of the classpath that you need.
  • Download Kaffe, and strip out parts that you don't need.
  • Grab the Java source code, and strip out parts that you don't need.

Good luck.

like image 1
Chip Uni Avatar answered Sep 22 '22 21:09

Chip Uni