Dynamic Tree Demo

Running a Java Web Start Application

Note: To run applications deployed with Java Web Start technology, you must have a compatible version of the Java Runtime Environment (JRE) software. The complete Java Java Development Kit (JDK) is not required.

Running a Java Web Start Application From a Browser

You can run a Java Web Start application from a browser by clicking a link to the application’s JNLP file. The following text is an example of a link to a JNLP file.

Java Web Start software loads and runs the application based on instructions in the JNLP file.

Running a Java Web Start Application From the Java Cache Viewer

If you are using at least Java Platform, Standard Edition 6 or later, you can run a Java Web Start application through the Java Cache Viewer.

When Java Web Start software first loads an application, information from the application’s JNLP file is stored in the local Java Cache Viewer. To launch the application again, you do not need to return to the web page where you first launched it; you can launch it from the Java Cache Viewer.

To open the Java Cache Viewer:

  1. Open the Control Panel.
  2. Double click on the Java icon. The Java Control Panel opens.
  3. Select the General tab.
  4. Click View. The Java Cache Viewer opens.

The application is listed on the Java Cache Viewer screen.

Читайте также:  CSS Master

A screen shot of the Java Cache Viewer application

Java Cache Viewer application

To run the application, select it and click the Run button, , or double click the application. The application starts just as it did from the web page.

Running a Java Web Start Application From the Desktop

You can add a desktop shortcut to a Java Web Start application. Select the application in the Java Cache Viewer. Right-click and select Install Shortcuts or click the Install button, .

A shortcut is added to the desktop.

You can then launch the Java Web Start application just as you would launch any native application.

Источник

Deploying a Java Web Start Application

To deploy your Java Web Start application, first compile the source code, package it as a JAR file, and sign the JAR file.

Java Web Start applications are launched by using the Java Network Launch Protocol (JNLP). Hence, you must create a JNLP file to deploy your application.

The Deployment Toolkit script contains useful JavaScript functions that can be used to deploy Java Web Start applications on a web page.

If you are unfamiliar with these deployment technologies, review the Deployment In-Depth lesson before proceeding.

Here are some step-by-step instructions to package and deploy your application. The Dynamic Tree Demo application is used to illustrate the deployment of Java Web Start applications. You might want to set up build scripts to execute some of the following steps.

Click the following Launch button to launch the Dynamic Tree Demo application.

Note: If you don’t see the example running, you might need to enable the JavaScript interpreter in your browser so that the Deployment Toolkit script can function properly.

  1. Compile your application’s Java code and make sure that all class files and resources such as images are in a separate directory. In the Dynamic Tree Demo application, the compiled classes are placed in the build/classes/webstartComponentArch directory.
  2. Create a text file that contains any JAR file manifest attributes that your applet needs. For the DynamicTree Demo applet, create a file named mymanifest.txt in the build/classes directory, and add the Permissions , Codebase , and Application-Name attributes. The applet does not require access to the user’s system resources, so use sandbox for the permissions. Use the domain from which you will load the sample for the code base, for example, myserver.com . Add the following attributes to the mymanifest.txt file.
Permissions: sandbox Codebase: myserver.com Application-Name: Dynamic Tree Demo
% cd build/classes % jar cvfm DynamicTreeDemo.jar mymanifest.txt webstartComponentArch
    Dynamic Team       

Note: The codebase and href attributes are optional when deploying Java Web Start applications that will run on at least the Java SE 6 update 18 release or later. You must specify the codebase and href attributes when deploying Java Web Start applications that will run with previous releases of the Java Runtime Environment software.

    

If you are not sure whether your end users will have the JavaScript interpreter enabled in their browsers, you can deploy the Java Web Start application directly by creating a link to the JNLP file as follows:

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

Источник

Оцените статью