Has the JVM design been holding back Java?

Update:Looks like the post has been linked from DZone. Tell me what you think? What kind of projects would you choose Java applets over Flash or AJAX?

After all these years, Java’s applet has not seen much adoption, while Flash continue to gain mindshare. Applets suffer from slow start up times, crashing browsers, heavy resource usage. The latest ‘solution’ from Sun is to keep the java libraries in the disk cache.

The latest client-side offering from Sun – JavaFX – improves the language, but does nothing about the underlying JVM itself (more about JRE 1.6u10 later). JavaFX is a fine language, once you get past the YAML syntax. Unfortunately, the JVM itself it the issue. JavaFX or not, Sun will not see JavaFX overtake Flash on most web pages.

When Flash 1.0 came out, it supported streaming bytecodes, and movies played immediately. JVM’s design requires all libraries to be downloaded, and then verified before playing in the sandbox.

The JVM implements share-nothing class libraries1, every new JVM process requires run-time libraries to be loaded up separately. This adds another block of run-up time before any screen is visible.

The JVM has a fundamentally flawed approach when the use-case is to run in a browsed environment, i.e. where people are moving from web page to web page quickly, and only having a taste of your application, and sometimes, involuntarily, as in the case of a banner ad1.

For browsing environments, I contend that Sun should have bundled some sort of interpreter in the VM, that can process a streamable language, in the manner of Flash. Sure, it is not Java, but it would have guided the evolution of the JVM. For example, we would have arrived at MultiVMs and OSGI much faster.

The Java camp has a reputation for dogma, e.g. rejecting delegates in favour of anonymous inner classes, static methods instead of standalone functions. There are promising signs of change. Invokedynamic and Annotations are nearly here, thanks to realization that the JVM needs to support dynamic languages, and thanks to competition from the .Net camp.

Sun engineers ought to ask themselves this question. “JVM is everywhere. What is Flash doing right but we aren’t?”

1Update 5 Sept, I was wrong. See this
2Incidentally, addressing this use-case will also address resource usage on shared hosters, making Java a viable competitor to PHP. See Matthieu Riou.


  1. I believe the newest update of the JVM (included with the JavaFX package) includes a rework where it will only download what that app needs to start up, then it downloads other libraries as needed later. So this at least seems taken care of.

  2. Hi Bob, Josef, Matt,

    Reading the fine-print on JRE1.6u10, I just don’t think download time is the critical factor. The new JRE will continue to have a high memory footprint, as there is still no concept of DLLs shared between java processes.

    A basic JavaFX applet will chew up 38Mb. How many web pages do you have on your tabs at the moment? Would you be able to do this if half the pages had JavaFX applets instead of Flash? That, my friends, is the problem.

    Faster start up time is a hack. This is called super preloading in OpenOffice. I’m not the only one who thinks this is a bad idea. Steven Bone had written about this back in 2005. Keeping JRE in the warm disk cache messes around with the OS’s pagefile, and causes other applications to be slower when swapping to and from disk.

    Unless Java applets gain significant traction, expect most users to go to the forums asking, “I’ve installed the latest Java and my system has become slower. There isn’t even any java applets running.”. This feature will be turned off very quickly unless suddenly applets come into fashion. Unfortunately, applets aren’t coming into fashion because it takes so much memory. What a mess.

  3. January 2009.
    Even today with 1.6 update 11, the startup time is still much longer than flash player. This is especially a problem when you program applets (can’t the just change the horrible name…?).
    I think JavaFx and java Web service applets can not be popular among developers with this slow strartup.
    Sun has to continue to put all of its energie with this dramatic issue.
    I mean java 1.6 update 11 with a “releaf update”.
    Now if Sun could give us a “wonderfully-fast-startup-jvm-like-Flash-does”, perhaps the java client side java-Swing and java-javaFx could be successfull. Not before I believe.

Comments are closed.