Sotirios-Efstathios Maneas

About Sotirios-Efstathios Maneas

Sotirios-Efstathios (Stathis) Maneas is a postgraduate student at the Department of Informatics and Telecommunications of The National and Kapodistrian University of Athens. His main interests include distributed systems, web crawling, model checking, operating systems, programming languages and web applications.

Java deployment toolkit (JDT) – How to use it

The Java Deployment Toolkit allows developers to easily deploy their applets and applications to a large variety of clients. The Deployment Toolkit script is a set of JavaScript functions that, help developers deploy their rich Internet applications (RIAs) consistently across various browsers and operating system configurations.
The script evaluates the underlying browser and operating system, and automatically generates the HTML code that is required, in order for a Rich Internet Application to be deployed. Moreover, this script can also ensure that the required version of the Java Runtime Environment (JRE) software is present on the client machine. Finally, the Deployment Toolkit script was introduced in the Java Platform, Standard Edition 6 update 10 release.

Location of Deployment Toolkit Script

The Deployment Toolkit script is located at the following web addresses:

Important: Use the 2nd link in order to deploy and launch your application, because the 1st link is currently being phased out. In this way, you will avoid any content warnings when your web page is loading.

Note: The JavaScript code in these locations has been minimized so that it can load quickly. You can view the human readable version of the JavaScript code with associated comment blocks at

The JavaScript interpreter should be enabled in the client’s browser so that the Deployment Toolkit script can run and deploy your RIA properly.

Deploying an Applet

You can deploy applets by using the runApplet function of the Deployment Toolkit script. The runApplet function ensures that the required minimum version of the Java Runtime Environment (JRE) software exists on the client and then, runs the applet. The runApplet function generates an HTML <applet> tag with the information provided.

You can deploy applets by specifying the deployment options as attributes and parameters of the <applet> tag. You can also specify deployment options in a Java Network Launch Protocol (JNLP) file to take advantage of advanced features.

Function signature: runApplet: function(attributes, parameters, minimumVersion)


  • attributes – The names and values of the attributes of the generated <applet> tag
  • parameters – The names and values of the <param> tags in the generated <applet> tag
  • minimumVersion – The minimum version of the JRE software that is required to run this applet

You can deploy an applet by using one of the following methods:

  • Specify the deployment options as attribute and parameter name-value pairs:
    The name-value pairs are translated into attributes and nested <param> tags in the generated <applet> tag. An example is shown below:

    <script src=""></script>
        var attributes = {codebase:'',
                          width:500, height:500};
        var parameters = {permissions:'sandbox'};
        var version = '1.6';
        deployJava.runApplet(attributes, parameters, version);

    The above sample code snippet shows how to launch an applet with one parameter, called permissions. The permissions parameter determines if the applet is executed inside the security sandbox, or if it requires permissions to access resources outside the sandbox.

  • Use the jnlp_href parameter to specify deployment options in a JNLP file:
    Again, the name-value pairs are translated into attributes and nested <param> tags in the generated <applet> tag. An example is shown below:

    <script src=""></script>
        var attributes = {code:'', width:500, height:500}; 
        var parameters = {jnlp_href: 'javaExample.jnlp'}; 
        deployJava.runApplet(attributes, parameters, '1.6'); 

    The “javaExample.jnlp” file has the following form:


    <?xml version="1.0" encoding="UTF-8"?>
     <jnlp href="javaExample.jnlp">
           <title>Java Example</title>
           <vendor>A sample name</vendor>
           <j2se version="1.6+"
                 href="" />
           <jar href=".jar" main="true" />
             name="Java Example"
  • Specifying attribute and parameter name-value pairs as well as a JNLP file.
    An example that specifies the applet tag attributes and JNLP parameters is shown below:

    var attributes = {codebase:'’, code:'.class', archive:'.jar', width:500, height:500}; 
    var parameters = { jnlp_href:'javaExample.jnlp'}; 
    var version = '1.6'; 
    deployJava.runApplet(attributes, parameters, version);

Important: The applet tag and the JNLP file provide overlapping mechanisms to specify the same information. A developer must be aware of the specifications and how the attributes get their final value, when some deployment options have different values in the attribute name-value pairs and in the JNLP file.

Deploying a Java Web Start Application

You can deploy Java Web Start applications by using the createWebStartLaunchButton function of the Deployment Toolkit script. Java Web Start applications are launched using Java Network Launch Protocol (JNLP). The createWebStartLaunchButton function generates an HTML anchor tag, that link to the Java Web Start application’s JNLP file.

When the end user clicks the Launch button, the Deployment Toolkit script ensures that the appropriate Java Runtime Environment (JRE) software is installed and then launches the Java Web Start application.

Function signature: createWebStartLaunchButton: function(jnlp, minimumVersion) or createWebStartLaunchButton: function(jnlp)


  • jnlp – The URL of the JNLP file containing the deployment information for the Java Web Start application. This URL should be an absolute path.
  • minimumVersion – The minimum required version of the JRE software, in order for this application to be executed.

Also, a Java Web Start Application can be deployed simply by creating a JNLP file that describes only the title, vendor, java version, jar file(s), and main class of the application. Then, the application can be deployed, by simply providing a link to the JNLP file on your web page.

Many other elements can be added to the JNLP file to control the user experience, security, and update process of your application, or to take advantage of several other features of the Java Network Launching Protocol (JNLP).

If the application wants to use some advanced features of JNLP and Java Web Start, that were introduced in a particular version, you may want to ensure that at least that version is installed, before launching the Java Web Start.

Java Network Launch Protocol

The Java Network Launch Protocol (JNLP) enables an application to be launched on a client desktop, by using resources that are hosted on a remote web server. The Java Plug-in software and Java Web Start software are considered JNLP clients, because they can launch remotely hosted applets and applications on a client desktop.

Both applets and Java Web Start applications can be launched by using the JNLP protocol. RIAs that are launched by using the JNLP protocol have access to:

  • Access to JNLP extensions.
  • Access to the JNLP APIs.
  • Version selection and more.

You can improve the user experience of your rich Internet application (RIA) using some of the following practices:

  • Sign the RIA using a certificate from a recognized certificate authority. Make sure that all artifacts are signed, and that the certificate has not expired.
  • Request the minimum level of permissions that is needed. If the RIA does not require unrestricted access to a user’s system, specify the permission level to be sandbox.
  • Optimize the size of “.jar” files and related resources, so that your RIA can load more quickly.
  • Enable the version download protocol and use background update checks to enable your RIA to start quickly.
  • Make sure that the client has the required version of the Java Runtime Environment software.

Checking the Client JRE Software Version

There are many reasons to check if a particular version of the Java Runtime Environment (JRE) software is available on a client machine. For example, your application may require features that were introduced in the latest JRE. In case that this requirement is not satisfied, you can redirect the user to a different page, in order to download the latest JRE.

You can use the Deployment Toolkit script’s versionCheck function to check if a particular version or range of JRE versions is installed on the client.

Function signature: versionCheck: function(versionPattern)


  • versionPattern – String specifying the version or range of versions, such as such as “1.6″, “1.6.0*” (1.6.x family), and “1.7.0_02+” (any version greater than or equal to 1.7.0_02).

A sample example, where we request that at least JRE 1.6 must be installed, is shown below:

<script src=""></script>
    if (deployJava.versionCheck('1.6+')) {            
        var url = "<url_to_JNLP_file>";
        deployJava.createWebStartLaunchButton(url, '1.6.0'); 
    else {
Related Whitepaper:

Java Essential Training

Author David Gassner explores Java SE (Standard Edition), the language used to build mobile apps for Android devices, enterprise server applications, and more!

The course demonstrates how to install both Java and the Eclipse IDE and dives into the particulars of programming. The course also explains the fundamentals of Java, from creating simple variables, assigning values, and declaring methods to working with strings, arrays, and subclasses; reading and writing to text files; and implementing object oriented programming concepts. Exercise files are included with the course.

Get it Now!  

Examples Java Code Geeks and all content copyright © 2010-2014, Exelixis Media Ltd | Terms of Use | Privacy Policy
All trademarks and registered trademarks appearing on Examples Java Code Geeks are the property of their respective owners.
Java is a trademark or registered trademark of Oracle Corporation in the United States and other countries.
Examples Java Code Geeks is not connected to Oracle Corporation and is not sponsored by Oracle Corporation.
Do you want to know how to develop your skillset and become a ...
Java Rockstar?

Subscribe to our newsletter to start Rocking right now!

To get you started we give you two of our best selling eBooks for FREE!

Get ready to Rock!
You can download the complementary eBooks using the links below: