Trail: Deployment
Lesson: Deployment In-Depth
Section: Deployment Toolkit
Subsection: Deploying a Java Web Start Application
Deploying Application Without the codebase Attribute
Home Page > Deployment > Deployment In-Depth
Deploying Application Without the codebase Attribute

Beginning in the Java SE 6 update 18 release, you do not have to specify an absolute path for the codebase attribute in the Java Web Start application's Java Network Launch Protocol (JNLP) file. You can develop and test your applications in different environments without having to modify the path in the codebase attribute.

The following functions of the Deployment Toolkit script can be used to deploy Java Web Start applications:


Note: To run, Java Web Start applications deployed by using the previously specified functions require at least the Java SE 6 update 18 release. If the client does not have at least the Java SE 6 update 18 release, the functions instruct the user to install the required Java Runtime Environment (JRE) software before launching the Java Web Start application.

Function signature: launchWebStartApplication: function(jnlp)

Parameter:

jnlp – The path to the JNLP file containing deployment information for the Java Web Start application. This path can be relative to the web page in which the Java Web Start application is deployed.

Usage:

In the following example, the launchWebStartApplication function is invoked in the href attribute of an HTML anchor (a) tag.

The dynamictree-webstart-no-codebase.jnlp JNLP file is used to deploy the Dynamic Tree Demo application.

<script src="http://www.java.com/js/deployJava.js"></script>
<a href="javascript:deployJava.launchWebStartApplication('dynamictree-webstart-no-codebase.jnlp');">Launch</a>

The Java Web Start application is launched when the user clicks the resulting HTML link.


Function signature: createWebStartLaunchButtonEx: function(jnlp)

Parameter:

jnlp – The path to the JNLP file containing deployment information for the Java Web Start application. This path can be relative to the web page in which the Java Web Start application is deployed.

Usage:

The following example shows the usage of the createWebStartLaunchButtonEx function.

The dynamictree-webstart-no-codebase.jnlp JNLP file is used to deploy the Dynamic Tree Demo application.

<script src="http://www.java.com/js/deployJava.js"></script>
<script>        
    var jnlpFile = "dynamictree-webstart-no-codebase.jnlp";
    deployJava.createWebStartLaunchButtonEx(jnlpFile);
</script>

The Java Web Start application is launched when the user clicks the resulting Launch button.

Open JavaWebStartAppPage_No_Codebase.html in a browser to view the Dynamic Tree Demo application that is deployed by using the functions described in this topic.

Download source code for the Dynamic Tree Demo example to experiment further.

Previous page: Deploying a Java Web Start Application
Next page: Changing the Launch Button