X
Business

Deploying applications with JNLP

David Petersheim shares on how remote clients can access and run applications on their local machines by using the Java Network Launching Protocol.
Written by David Petersheim, Contributor

This article originally appeared in Builder AU.

Remote clients can access and run applications on their local machines by using the Java Network Launching Protocol (JNLP). JNLP applications are like standard Java applets in that access to the application begins in a Web browser, and the JNLP can be confined to a secure "sandbox" on the client machine. Unlike applets, JNLP applications don't run inside the client's browser; instead, the Web browser is used as a jumping-off or installation vehicle for the application.

You'll implement JNLP as an application called Web Start. In order for your clients to access your JNLP applications, they must first install Java Web Start. (See Sun's Java Web Start page for more information on installing and using Java Web Start.)

One of the biggest advantages JNLP applications have over standard client applications is that JNLP apps are self-installing and self-updating. Once the application is installed (via the Web browser) on the client, the application will update itself when necessary as long as it has access to the network. All resources for JNLP applications are delivered via the network. This spares an application's administrator from having to visit each machine to install and update applications.

Web Start applications are regular Java applications that are written to the JNLP specification; but there are differences you'll want to know before you head down the JNLP path. Here are several things to be mindful of when developing your Web Start applications:

  • You must store a Web Start application's resources in jar files on the server. These jar files will be transferred to the client for access by the application. Since all resources must be stored in jar files, the application must use ClassLoader's getResource() to access any files it needs from these jar files.
  • A Web Start application starts with a main method like most other Java applications. The main class is defined in a JNLP file, which is an XML document that stores other application configuration information such as description, application icon, code base, permissions, etc.

  • You must configure your Web server to deliver a specific MIME type for your JNLP documents. This configuration is usually simple, but if it's not done, your applications may not deploy properly.
  • Like Java applets, your application will be constrained to a sandbox on the client unless you used signed jars and configure permissions correctly in your application's JNLP file.

Even with the above caveats, using JNLP and Java Web Start for your next distributed application may be an option. To get detailed information on what it's like and to test out a Java Web Start application, visit Sun's Java Web Start home page.

David Petersheim is the Director of Application Development with Genscape, Inc. He designs and develops server-side applications to acquire and process real-time energy data.

Editorial standards