Vous êtes ici

A small application to help studying vocabulary lessons - web start

This article is the fourth one, in a series of several ones (Smile). The previous article is here.

In this article, we will see how to deliver our application, using Java Web Start. In a few words, Java Web Start provides a way to install an application on your local PC, simply clicking on a link in a web page. Below are a few interesting pointers about this matter:

So, let's start to package our application according to Java Web Start requirements, so that it can be installed on linux systems, and on Windows systems as well:

  • create a directory named review
  • into this directory, put swt.jar, extracted from swt-3.5.1-gtk-linux-x86.zip, available on SWT site
  • rename swt.jar to swt-gtk-linux-x86.jar
  • perform the same steps, for the Windows version, renaming it to swt-win32-windows-x86.jar
  • add review.jar into the directory
  • add derby.jar, copied from eclipse/plugins/org.apache.derby.core_10.5.3
  • create following review.jnlp file, replacing codebase and homepage href values by refrences to the web site you'll use to store above files:

    <?xml version="1.0" encoding="utf-8"?>
    <jnlp spec="1.0+"
        codebase="http://www.monblocnotes.com/"
        href="review.jnlp">
        <information>
              <title>Révision</title>
              <vendor>monblocnotes.com</vendor>
              <homepage href="http://www.monblocnotes.com" />
              <description>Révision du vocabulaire</description>
        </information>
        <security>
            <all-permissions />
        </security>
        <resources>
            <j2se version="1.6+" />
            <jar href="review.jar" />
        </resources>
        <resources os="Linux">
            <nativelib href="swt-gtk-linux-x86.jar" />
            <jar href="swt-gtk-linux-x86.jar" />
        </resources>
    <resources os="Windows" arch="x86">
    <nativelib href="swt-win32-windows-x86.jar" />
    <jar href="swt-win32-windows-x86.jar" />
    </resources>
        <resources>
            <jar href="derby.jar" />
        </resources>
        <application-desc main-class="com.monblocnotes.review.Review" />
    </jnlp>
  • create a keystore for signing jar files: keytool -genkey -keystore keystore -alias myself
  • sign each jar file: jarsigner -keystore keystore <filename> myself
  • put all files on the web site
  • point the browser to the remote review.jnlp file
  • that's it!

A few conclusions after this first test:

  • in our configuration, an access to the web is required, when launching the application, even if it's already locally cached. To remove this restriction, offline-allowed element can be added to the jnlp file...
  • database contents is not lost, between two application activations: great Cool
  • Derby is provided with Java 6. How to use it, instead of providing derby.jar? But beware of version upgrades...
  • MessageBox does not work anymore when the application is run in Java Web Start context. I'm quite sure that comes from the way I'm using it in my code. To be checked... Anyway, having not found any solution for now, I simply replaced MessageBox by MyMessageBox (refer to the source code).
  • the signing process we went through uses self-signed certificates. That's not so good, as a warning message is displayed at installation time...