Here is an example of how an application, our CubicGraph from Chapter 3, can be converted to an applet.
lineMover.htmlANCHOR Testing the applet
You can test the applet using a program called appletviewer:
In order to insure that the applet runs in as diverse an environment as possible, use the Java program HtmlConverter.
HtmlConverter lineMover.htmlADDANCHOR webstart ANCHOR Java Web Start
Java Web Start gives a way to distribute Java applications
First, your web server needs to be reconfigured to recognize the JNLP mime types. On the apache server, this is as simple as adding the line
application/x-java-jnlp-file JNLPto the file /etc/mime.types. ANCHOR Preparing the jar file
The application needs to be packaged in a "jar" file that is digitally signed.
jar cvf jarfilename.jar classfilenames
keytool -genkey -alias david
keytool -selfcert -alias david
jarsigner myjar.jar david
Here is an example
Download the application. ANCHOR Using Web Start as a client
To use applications delivered by Java Web Start, we need to install Web Start locally.
Web Start is installed automatically when the Java 1.4.1 JRE or SDK is installed on a Windows machine.
Under linux, it is as simple as copying a file named something like
into a directory in your home directory, unzipping the file and running install.sh. LASTANCHOR Advantages
Web Start allows the user to run the application locally. In addition, it will check for updates and download them when they are available.