FREE Subscription to Dr. Dobb’s Digest: Same Great Content, New Digital Edition
Site Archive (Complete)
Java Blog: The Java Kernel
Java
SWAINE'S CAFE

Black. No Sugar. Extra Caffeine.

by Mike Swaine
ERIC BRUNO'S BLOG

Java: The Daily Grind.

by Eric Bruno
May 25, 2007

The Java Kernel

Sun is building a JRE of minimal size that downloads classes as needed over the network.

The problem today is that most of Java’s runtime classes are bundled into one monolithic JAR file (rt.jar). Even if you need only a small percentage of the classes contained within it, your application requires the entire JAR file. This isn’t a problem if the JAR file is on the filesystem with your application. It becomes an issue when components run in a distributed environment, where classes need to be downloaded over a network. Today, instead of loading only the portions you need, the entire JAR would have to be downloaded. This is precisely the problem that has prevented Java Applets from being used more widespread than they are today.

Enter the Java Kernel, which requires only the class files needed to run a “Hello, world!” application. If an application executes code that requires more classes, only those classes are downloaded, saving both time and resources. To be clear, classes are grouped into what are called “bundles,” of which there are about one hundred currently defined. A compromise was made to balance the overhead of requesting classes one by one (many network round-trips) versus downloading classes as bundles, even if an application doesn’t need all the classes in a bundle. Given that there are about one hundred or so bundles, the tradeoff between bundle size and download requests seems reasonable. You can also build a custom bundle containing just the classes required for your particular application.

The goal has been to get the JRE below 2MB in size. To do this, Sun has omitted many optional features from the JVM such as the various garbage collectors that come with it (instead it uses just one). The result is that the Java Kernel JRE, which contains the JVM, the Java plug-in, Web Start, java.exe, javaw.exe, javaws.exe, support libraries, and various other files, is at 1.9MB in size.

Posted by Eric Bruno at 09:39 AM  Permalink




 
INFO-LINK