Java Web Start Used to Deploy a Java Application
Feb 2, 2013
This blog post is about how Java Web Start 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.
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.
Developing and Deploying Java Web Start Application
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. Applets and Java Web Start applications are not the same.
- 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.
Running Java Web Start Application from the Client
The client computer requires a compatible (with the application) version of the Java Runtime Environment (JRE).
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.
Re-Running Java Web Start Application from the Java Cache Viewer on Windows 7
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
NOTE: Java Cache Viewer can also be started from the operating system command prompt:
Command Prompt> javaws -viewer
Link to the Application
The home page of the application deployed using Java Web Start, which is also this blog post's home page.
- Oracle's Java Web Start FAQ’s
- Oracle's Java Tutorials > Deployment (Developing and Deploying Java Web Start Applications)
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.
Return to top
<?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>
Comments are welcome. Please note that comments are moderated.
Email to: info(at)javaquizplayer(dot)com.