From time to time WebRenderer is deployed within an Applet. Applets provide a convenient mechanism for launching client applications within the browser. WebRenderer however requires different libraries based on the target platform (Windows, Linux, OS X, Solaris) and architecture (32/64 bit). Traditionally to run an Applet, you needed to specify all of the libraries that are required, and they will all be downloaded. If you intend for the Applet to run on multiple platforms, then traditional Applet deployment means that all the libraries for the supported platforms are required which results in the downloading of many unnecessary files.

All is not lost however. It is possible to launch an Applet in a way that will only download the relevant files for the target system. This is done through a JNLP file that is usually associated and used with Java Web Start programs. The JNLP deployment option for Applets was introduced in Java 1.6.0_10.

The following code is an example JNLP file that can be utilized to deploy an Applet with platform targeted libraries:

This JNLP file (webrenderer-applet.jnlp) specifies the WebRenderer libraries as resources under different Operating Systems and Architectures. Through this deployment specification only the files needed are downloaded to the target machine. For demonstration purposes WebRenderer is run from a simple program called TestBrowser (included with the WebRenderer download) and is specified at the end of the JNLP file above under “applet-desc”.

Enabling JNLP deployment for Applets requires an extra param tag to be added inside the Applet tag that refers to the JNLP file:

The architecture used on a particular platform by the Applet depends on the Java architecture that the browser is using. So on a 64-bit OS that is using 32-bit Java, the 32-bit WebRenderer libraries will be used.

The values for “arch” property are the same as is returned in Java by the function:

System.getProperty("os.arch")

As with all Applets, each library will need to be signed. Details on signing your Applets resources can be found here..

These icons link to social bookmarking sites where readers can share and discover new web pages.

About this blog..

This is an informal place for the team
at JadeLiquid to discuss software, the rotation of the
earth and other things usually discussed in the JadeLiquid
corridors.