I program in Java for a living. I love the language. I like how it’s statically typed, I like how it has libraries for everything, I like how Sun is cross-licensing it under the GPL. The JVM load times are getting better, and as Java applications become more and more common the JVM load time and memory overhead will become less and less important. The UI toolkits are getting better and better, Linux and OS X are increasingly integrating Java with their core UIs, and Java Web Start is becoming a great way of delivering applications.

But I hate Java applets. I can’t stand them. And I think they are the #1 source of misconceptions about Java in general, and the source of most of the worst pet peeves about Java applications.

First of all, they’re slow. Java has a reputation of being slow in general, and I think this is a big reason why. When I visit a web page containing a Java applet, my browser instantly freezes. It remains frozen for several seconds, sometimes as many as thirty. Then I’ll get an empty grey box while the applet loads. This grey box may last anywhere from a few seconds to several minutes, depending on the size and complexity of the applet, and nowhere am I given a sign of how long it will take.

Compare this with Flash. When I visit a page with a Flash plugin, there is a slight slow-down for the plugin to load, but the browser is typically responsive again within a second. I’m not sure if this is because Flash spins off another thread to do the heavy lifting, or delays loading all of the framework until the swf is downloaded, but the Java plugin could easily do the same. Then, the Flash swf typically begins to play some sort of “loading” image immediately, giving me an idea of how long it will take to load. This would be trickier for Java to do, but with some work (perhaps a limited UI library and a class that is loaded first) it would definitely be achievable.

The second big reason I hate Java applets is because they’re ugly. This is mostly a problem of AWT, the default UI toolkit for applets, and by far the ugliest. But even when applets are written using Swing (which is rare), there is hardly any native UI integration. It still looks, painfully so, like Java.

Unfortunately, because of the early problems with applets, Sun has all but abandoned the idea of Java as a web platform. The main use of Java these days is on the back-end, as part of complex frameworks which generate applications built on dynamic HTML. As Java has matured (and other big players like IBM’s SWT have appeared on the scene), desktop applications are becoming more common. But it’s lamentable to see these correctable issues go years and years without being sufficiently addressed.

It would take some heavy work (and a lot of PR to overcome the current poor image), but Java could be a viable contender with Macromedia’s Flash. Many of the things that Flash is currently popular for could be done just as well or better in Java, if only these plugin weaknesses were corrected. Flash would once again be relegated to the role of cutesy cartoons and animations, with Java finally able to excel in what it was originally designed for.

Leave a Reply