Java Web Start used to Deploy a Java Application
Feb 2, 2013
This blog post is about how Java Web Start (JWS) technology is used to deploy a Java Swing application. The application is deployed on a Java enabled web server. And, the application is launched from a web browser on a client computer.
1. Java Web Start
Java Web Start is an application deployment technology. This is part of Java Standard Edition (Java SE).
Using Java Web Start, launch (download and start) an application from a web browser without an installation procedure. Java Web Start caches the application on the client computer and can be re-started without downloading.
Java Web Start software takes advantage of the inherent security of the Java platform. By default, applications have restricted access to local disk and network resources.
2. Developing and Deploying Java Web Start Application
2.1. Developing
Java Web Start applications are considered Rich Internet Applications (RIA). Software designed using component based architecture (GUI that can be built with smaller building blocks or components) can easily be developed and deployed as a Java Web Start application. A Java Swing application is an example. Note that the Applets and Java Web Start applications are not the same.
2.2. Deploying
- Package the application as a JAR file.
- Create a Java Network Launch Protocol (JNLP) file to deploy the application. Java Web Start applications are launched using the JNLP. Java Web Start software loads and runs the application based on instructions in the JNLP file. See an example JNLP file (listed at the end of this blog post).
- Create a HTML page from which the application will be launched. Create a link to the JNLP file; for example:
<a href="theapp-webstart.jnlp">Launch the application</a>.
- Create a WAR (web archive) file with the application's JAR file, JNLP file, and the HTML page.
- Deploy the WAR file on the web server.
3. Running Java Web Start Application from the Client
The client computer requires a compatible (with the application) version of the Java Runtime Environment (JRE).
3.1. Running Java Web Start Application from the Web Browser
Open the application's HTML web page in a browser. Click the ‘Launch the application’ link. This action downloads and starts the application. This also caches the application on the client computer.
3.2. Re-Running Java Web Start Application from the Java Cache Viewer on Windows 7
Navigate Windows > Control Panel - Programs > double click Java icon > Java Control Panel window - General tab - View button
, to open the Java Cache Viewer (the application is listed under Applications; right click menu has options to create a desktop shortcut or run the application).
The application is listed with the name defined in the JNLP file (the <title>
of the <information>
tag).
NOTE: Java Cache Viewer can also be started from the operating system command prompt:
Command Prompt> javaws -viewer
4. Link to the Application
The Quiz Apps of this web site are deployed using Java Web Start.
5. Useful Links
- Oracle's Java Web Start FAQ’s
- Oracle's Java Tutorials > Deployment (Developing and Deploying Java Web Start Applications)
6. Example Java Network Launch Protocol (JNLP) File
The JNLP file specifies the name of the main JAR file, the version of Java Runtime Environment that is required to run the RIA, name and display information, optional packages, runtime parameters, system properties, and so on.
<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="1.0+" codebase="http://www.thewebapp.com/"
href="http://www.thewebapp.com/theapp-webstart.jnlp">
<information>
<title>The Application</title>
<vendor>A Team</vendor>
</information>
<resources>
<java version="1.7+"/>
<jar href="theapp.jar" main="true" />
</resources>
<application-desc
name="The Application"
main-class="TheApp">
</application-desc>
</jnlp>
Return to top