Reduce Java SE's Footprint - updated
The Java SE platform has grown with each release, and update. Sun and the community have been consistently adding features and tools to the bundle, which is generally a good thing. For instance, Java SE now comes with a full-blown RDBMS, based on Apache Derby, called JavaDB. This is a great addition for those who need a mid-range database for a standalone Java application. However, for those wishing to deploy Java SE into slightly constrained environments, this can be frustrating.
Of course, there's always Java ME's CDC virtual machine, which is bytecode compatible with Java SE, for constrained devices. However, for some, there is a need or desire to stick with standard Java. One solution is to slim down the Java SE distribution, but it must be done in a way that doesn't violate Sun's license. This requirement is there for a reason; without it, the Java platform is susceptible to fragmentation, and doomed to incompatibility, and ultimately failure.
But there is a way to reduce the Java SE footprint and not violate the license. My friend, Jim Connors, has written a blog entry about it here: http://blogs.sun.com/jtc/entry/reducing_your_java_se_runtime.
Of course, Java 6 update 10 (http://java.sun.com/javase/downloads/ea/6u10/6u10beta.jsp), with the Java kernel and modularization, goes a step further in reducing both the memory and storage footprint of Java SE. However, considering it's still in beta, and for those of you who need to stick with older versions for some time, the solution proposed by Jim Connors may be the only license-compatible choice.
Finally, there are other Sun-supported options to use Java SE on constrained devices where the distribution is reduced even further in size. Take a look at Java SE Embedded (http://java.sun.com/javase/embedded/index.jsp) where there's support for headless environments, different CPUs (Intel, ARM, MIPS, and PowerPC), and operating systems.
Update: One reader informed me of his company's product that offers a Sun-licensed and approved method to reduce the footprint of deployed Java applications. The company is named Excelsior, and the product is called Excelsior JET. See http://www.excelsior-usa.com/java-download-size.html for more information.
Basically, it works by analyzing your Java SE application to determine its dependancies. Then it creates an executable from the bytecode that includes only the Java libraries that your application requires. It will also package the application for installation using the setup program of your choice.
With this solution, you actually don't need the JRE to be installed on the target computer. You do, however, need to follow Sun's license requirements concerning Java compilation. All of the details around this can be found on Excelsior's site.