java web start application

Building a Java Web Start Application

While checking out some tutorials of Java on the Oracle website, I discovered that they were using Java Web Start Launcher Applications as demo for the viewers. Basically the applications are JNLP Files  ( Java Network Launch Protocol ). For the applications to work, you do need to have Java installed on your system.

The main advantage in using Java Web Start technology is you can deploy independent software on any system over the network. Most of the demos that are offered by Oracle for Java are JNLP files which are powered by Java Web Start Launcher. The JNLP files are mostly governed by a XML schema which defines all of it’s features.

Java Web Start Application

A few weeks back I shared a Java Application where you can add and remove elements dynamically from a JPanel. For the purpose of the demo of the Java Web Start Application, I have used that particular JAR file. The Java Web Start basically starts a remote Java Application Software on the client machine.

Localhost demo

So, basically we have two files – A JAR file and a JNLP file. The JNLP file acts as the web launcher which runs the JAR application file on the client machine. For a localhost, the following would be the code for a XML file.

<?xml version="1.0" encoding="utf-8"?>
<jnlp spec="1.0+" codebase="http://localhost/projects/JavaWebStart/" href="java.jnlp">
    <information>
        <title>JNLP Testing</title>
        <vendor>Lion Blogger</vendor>
        <homepage href="http://localhost/" />
        <description>JNLP Testing</description>				
    </information>
    <security>
        <all-permissions/>
    </security>
    <resources>
        <j2se version="1.7+" />
        <jar href="JavaDemo.jar" />
    </resources>
    <application-desc main-class="addremove_no_db" />
</jnlp>

Now onto the most important explanation.

  • The ‘codebase’ refers to the directory in which the JNLP file is present.
  • The ‘href’ refers to the name of the JNLP file.
  • The ‘jar href’ refers to the JAR file or the application that will be ran on the client machine.
  • The ‘main-class’ refers to the main Java class that is responsible for the running of the application.

java web start application

Demo

As a demo to see how it works, I have set it up here on Lion Blogger. So, just click on the Launch Button and it should work.jws-launch-button

As for the warning part, the application is self signed. If you have your own CA, then you can use it and add it’s resources within the project to suppress the particular message.

Share this post :
Lahaul Seth

Lahaul Seth

Software Engineer, Open Source Enthusiast & Blogger - I also own Lion Blogger Tech which focuses on Open Source, UI, UX, Technology.

I also own Open Source Software News which is a curation site for Open Source Technology News & Updates.

Also check out my personal site.