JavaEnterprise JavaHypewatch: WebStart for Java

Hypewatch: WebStart for Java

Developer.com content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More.

Using Java instead of another programming language gives you a lot of cool advantages. You know the drill: Quick development time, write once run anywhere, and a large selection of libraries and tools. But there are a couple of major downsides, too. One of the not-often-discussed disadvantages to Java is that it needs a JVM — a virtual machine.

David Fox

On the server side, that’s no big deal. Just have the server admin install a JVM of your choice and you’re off and running. But on the client side, it gets sticky.

Writing a Palm application using Java 2 Micro Edition (J2ME), for example, is extremely fun and easy using Java. But if you want to actually sell or give out your program to the mass market, you have to convince them not only to buy and install your application itself, but the KVM — a pretty substantial hunk of bytes.

On the desktop, Java is equally painful to deploy. If you want to write an applet, you’re fine — as long as you want to use Java 1.1.8, since that’s all that Internet Explorer supports. If you want to get more advanced and write an application, your posterior will become even more pained. Most Windows machines do have JView — Microsoft’s version of Java — preinstalled. But as with the applet engine, it is a creaky, old Java version. Most developers want to write to the latest and greatest JDK, 1.3.1.

So Sun created WebStart. At first glance, this seems to solve all our problems. WebStart is basically an all-in-one tool that, with one click, installs both a Java application and any necessary JVM or other needed libraries. Java WebStart is smart enough to cache classes on your hard drive, as well — so that if you try to run a program you have already downloaded, it’ll start up instantly. Further, if any of the classes are out of date, WebStart will automatically retrieve the latest.

WebStart also runs as a separate application. So even if you close your browser or work offline, you can continue to use a given Java program. You can even have a WebStart application create a desktop shortcut, so that you can launch the program the same way you’d launch any other native software.

The WebStart package is definitely well thought out, and it has lots and lots of good stuff in it. There are versions available for Windows, Solaris, and Linux, and it can handle any version of Java. It also has nice security features like code signing and sandboxing.

Some companies are also installing Java and WebStart as a matter of course on all their computers.

WebStart uses something called the Java Network Launching Protocol (JNLP) to deploy Java apps. A JNLP file is written in XML and basically describes what Java JAR file to download, what JRE to use with it, whether offline running is allowed, as well as the application’s security settings. It looks something like this:

<?xml version="1.0" encoding="UTF-8"?>
<jnlp codebase="$$codebase">
  <information>
  	<title>My Cool Application</title>
         <vendor>My Cool Self</vendor>
         <description>A Cool App</description>
         <icon href="icon.gif"/>
         <offline-allowed/> 
   </information>
   <resources>
       <j2se version="1.2+"/>
       <jar href="application.jar"/>
   </resources>
   <application-desc/>
</jnlp>

Applications you write can also use JNLP API to easily access system-level objects such as the clipboard, the file system, and any printers. You can then launch the WebStart application using HTML code similar to like this:

<a href="CoolApp.jnlp">Click here to Launch the Coolest App!</a>

Looks pretty easy, don’t it?

But looks can be deceiving. After all, the whole purpose of WebStart was to make installation and deployment easier. But we’ve got a bit of a Catch 22 on our hands — you still have to convince your users to install WebStart in the first place.

Let’s say that you are a user trying to run a small, 50K Java app. If you try to click on the application but have not downloaded WebStart yet you will see a message like this:

“In order to launch the requested application, you will need to download Java Web Start Version 1.0. This installation is a one-time process.”

You need to download the 5.3MB program — not exactly trivial for modem users — and then install it. If you don’t have Java Runtime Environment (JRE) 1.3.1 already installed — and most users won’t — then WebStart will need to download and install that, too. That’s another five and a half megs! Netscape users then need to restart their browsers and remember what page they came from.

Kind of a lumbering, roundabout way to run a measly 50K app.

Granted, running your WebStart app the second time around is much quicker and easier. Just click and go.

These days, a few PCs and browsers are being released with the Java Runtime already preinstalled. That’s good. Some companies are also installing Java and WebStart as a matter of course on all their computers. That’s good, too. But until most platforms around the world have WebStart on them, until Java becomes as ubiquitous as Microsoft Windows, Java will be fated to become a rarity on the client side. It’s a shame, but it’s also a fact.

About the Author

David Fox is the author of numerous books and articles about cyberculture and technology.

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Latest Posts

Related Stories