Deploying WebRenderer via Java WebStart







Java WebStart is a process of deploying Java applications over the internet. WebStart applications are acompanied by some specific files including a JNLP file. A core part of the JNLP file is the codebase tag. This tag must point to the server on which your application resides. Such as: codebase="http://www.webrenderer.com/webstart/"

Core Requirements

When deploying WebRenderer through WebStart we have had success by doing the following:

1 - All jars must be signed with the same key file.

Key file generation:

keytool -genkey -keystore WRKeystore -alias wrstore

File wrstore generated, then

Jars signing:

jarsigner -keystore WRKeystore <jarname> wrstore

e.g to sign webrenderer.jar

jarsigner -keystore WRKeystore webrenderer.jar wrstore

3. Write the JNLP  file
Heres an example of codebase in a JNLP file (please note the Security section):

codebase="{set here base URL where all jars stored for example http://www.webrenderer.com/webstart/}"
href="{Your application name}.jnlp">
    <j2se version="1.4"/>
    <jar href="{Your application jar}"/>
    <jar href="webrenderer.jar"/>

Picking the platform in JNLP

  <resources os="Windows">
    <jar href="webrenderer-win.jar"/>
    <jar href="corecomponents-win.jar"/>
  <resources os="Linux">
    <jar href="webrenderer-linux.jar"/>
    <jar href="corecomponents-linux.jar"/>
  <resources os="Mac OS X">
    <jar href="webrenderer-osx.jar"/>
    <jar href="corecomponents-osx.jar"/>
  <resources os="Sun">
    <jar href="webrenderer-solaris.jar"/>
    <jar href="corecomponents-solaris.jar"/>

Using this method to deploy will ensure the correct files are downloaded to the client WebStart based on the platform you are running, amounting to an efficient cross-platform distribution.

Closing WebRenderer when your application terminates

You must call System.exit(0); when you close your Java WebStart application, to destroy the WebRenderer instance. If you do not call System.exit(0) your application will still be running without a Window and if you try to run your application again, you will receive a java.io.FileNotFoundException, which will point to WebRenderer.






Copyright JadeLiquid Software - www.jadeliquid.com