Friday 21 September 2018

Java Web Start with IBM Java 8 on Ubuntu Linux

Java Web Start

Java Web Start is a framework that allows running java application straight from the network, however, unline applets, these application do not run inside your browser. Java Web Start applications run in a sandbox similar to Java applets, but do not rely on browser plug-ins. A JNLP (which stands for Java Network Launch Protocol) launcher file allows launching an application on the client desktop using resources (e.g. jar files) hosted on a web servers.

From the command line

The launcher file (or a URL pointing to the it) is passed to the javaws command. Subtle details like signatures, permissions (java.policy) and java security settings (ControlPanel) need to be correctly configured.

Using a Java Runtime that is not part of the Linux distro, or not even installed via the package manager is not complicated. Just make sure you invoke the correct javaws binary via symlinks/alternatives or just specifying the file path of the binary rather than relying on the PATH environment variable.

From the GUI

Rather than tinkering with system global settings, I just created a desktop launcher file ~/.local/share/applications/ibmjava8-javaws.desktop with the following content:


[Desktop Entry]
Name=IBM Java8 Java Web Start
Comment=IBM Java8 Java Web Start
Exec=/usr/lib/jvm/java-ibm-x86_64-80/jre/bin/javaws %u
Terminal=false
Type=Application
Icon=javaws
Categories=Application;Network;
MimeType=application/x-java-jnlp-file;
NoDisplay=true

Once done, I downloaded a .jnlp file, saved it to /tmp, right clicked it in nautilus file manager, and ensured it will be opened via the freshly created desktop laucher for IBM Java8 by default.

From the browser

After carrying out the previous steps, clicking a link to a .jnlp file on a web page will - depending on your browser settings - just launch Java Web Start (which will typically show signer information and prompt you for confirmation) or offer you to either save the file to disk to open it via IBM Java8 Java Web Start. That is all it takes.