These documentation pages are no longer current. They remain available for archival purposes. Please visit
https://docs.oracle.com/javase
for the most up-to-date documentation.![Convert Jar File Jnlp Convert Jar File Jnlp](https://cloudbees.zendesk.com/hc/article_attachments/205548017/node-launcher.png-ac96c4e7)
Go to the directory where the main jar file is: cd usr/share/icedtea-web/ and just run your jnlp file: java -cp netx.jar net.sourceforge.jnlp.runtime.Boot -Xnofork -jnlp myapplication.jnlp Depending on your application you could have to change options. You can list them with: java -cp netx.jar net.sourceforge.jnlp.runtime.Boot which result in. In Java Web Start technology, the same certificate must be used to sign all JAR files (jar and nativelib elements) that are part of a single JNLP file. This simplifies user management since only one certificate must be presented to the user during a launch per JNLP file.
Java Rich Internet Applications Guide > Migrating Java Applets to Java Web Start Applications
This guide is intended to help developers migrate their existing Java Plug-in applets to Java Web Start applications. While it should be possible to migrate most applets without problem, there are some considerations for developers to be aware of when making the migration. The following guide describes details of the migration process.
The following topics are covered:
- Migrating an Existing Java Applet
Advantages of Migrating to Java Web Start Technology
Migrating provides the ability to target to a specific Java Runtime Environment (JRE) version or a specific version range. Java Web Start technology supports multiple, simultaneous versions of the Java Standard Edition platform. Specific applications can request specific Java versions without conflicting with the different needs of other applications. Java Web Start technology automatically downloads and installs the correct version of the Java platform as necessary, based on the application's needs and the user's environment.
Another advantage is that users can launch a Java Web Start application independent of a Web browser. A user can be off-line or unable to access the browser. Desktop shortcuts can also launch the application, providing the user with the same experience as that of a native application.
Migrating an Existing Java Applet
Java Web Start technology has built-in support for applets. It is possible to run your applet directly with Java Web Start technology without any re-compilation of the applet. All you need do is to convert your applet HTML tags to a Java Network Launching Protocol (JNLP) file, using the JNLP
applet-desc
element. For example:Targeting to a Specific JRE
You can specify the targeted JRE versions using the
java
element and its version attribute. It supports the +
and *
operators, and you can even list out the exact version. Some examples follow:- Run with Java 5 or above:
<java version='1.5+'/>
- Run with anything in the Java 5 family:
<java version='1.5*'/>
- Run with Java 5 update 12 or above, or with Java 1.4.2 update 20 only:
<java version='1.5.0_12+ 1.4.2_20'/>
All your applet resources must be packaged inside a JAR (Java archive file), and have the JAR file listed using the
jar
element.The
applet-desc
element contains all the applet's information such as applet parameters, width, height, etc. For more information regarding the applet-desc
element, refer to the JNLP specification, section 3.6.2, 'Application descriptor for an Applet.'With the
applet-desc
tag, Java Web Start technology uses its own version of the applet viewer to start your applet.Re-writing a Java Applet as a Java Web Start Application
The best way to migrate your applet is to re-write it as a standalone Java application, and then deploy it with Java Web Start technology. Re-writing your applet and testing the resulting application ensures that your converted applet works fully as expected. And your application can take advantage of the Java Web Start features.
The re-write should be fairly straight forward. The major work needed is to convert your
applet
class to the main
class of the application. The applet init
and start
methods are no longer present, instead, you should initialize the application at the beginning of the application's main
method.To quickly begin the migration, you can just add the
main
method to your original applet
class, and then start calling your applet initialization code where it normally gets called from the applet's init
and start
methods. Once there is a main
method in the applet
class, you can begin launching it by means of Java Web Start technology, and then slowly remove the dependency on the Applet
class and convert it completely to your application's main
class.For more information, refer to JNLP File Syntax.
Special Considerations
Following is a list of considerations that may be important when migrating.
- A Java Web Start application does not run within the web browser. So if your applet has any dependency on the browser (for example, Java to JavaScript / JavaScript to Java communications by means of the browser), the communication code will no longer work. The APIs that are affected include:
JSObject
API (netscape.javascript.JSObject.*
) for Java to JavaScript communication does not work for Java Web Start applications.- Common Document Object Model (DOM) API (
com.sun.java.browser.dom.*
andorg.w3c.dom.*
) available for Java Plug-in applets are not available to Java Web Start applications.
- Similar to Java Plug-in technology, Java Web Start technology will cache your application JARs for faster start-up performance. However, resources downloaded by your own application code will not be cached by Java Web Start technology.
- Java Web Start technology provides permanent cookie support on Windows using the cookie store in Internet Explorer, and the cookie-handling behavior is determined by the cookie control in IE. On Linux/Solaris, Java Web Start technology provides permanent cookie support using its own cookie store implementation. For more information, see Cookies in the Java Tutorials.
- If you deploy an applet with the JNLP
applet-desc
element, your applet will be created using theAppletContainer
provided by Java Web Start technology. When your applet callsApplet.getAppletContext()
, it returns theAppletContainerContext
provided by Java Web Start technology. There are some minor differences in implementation between the Java Plug-inAppletContext
and the Java Web StartAppletContext
. The differences are:- The following Applet Persistence API methods are not implemented by Java Web Start technology:For Java Web Start applications, you can use the JNLP Persistence Service API for storing data locally on the client's system. For more information, see the
PersistenceService
interface. - For
AppletContext.showDocument(URL url, String target)
, the target argument will be ignored by Java Web Start technology. - For
AppletContext.showStatus(String status)
, when launched with Java Web Start technology, this will set theJLabel
text that is below the applet, hosted by the Java Web StartAppletContainer
.
- Similar to
AppletContext.showDocument
, Java Web Start applications are capabile of showing an HTML page using the system's default web browser by using theBasicService.showDocument
API.For a Java Plug-in applet:For a Java Web Start application:For more information, see theBasicService
interface. - In an applet, if you obtain a resource by means of these calls:Then in Java Web Start technology, the best practice is to include the resources in your application JAR files, and access the resources using the
JNLPClassLoader
:For more information, see Retrieving Resources from JAR Files. - The pack200 JAR packing tool is supported by both the Java Web Start and the Java Plug-in technologies. If you are already deploying your applet JARs with pack200, no change should be needed when migrating to Java Web Start technology. For more information, see Deploying JAR Files Compressed with Pack200.
- By using the
OBJECT
tag in Java Plug-in technology, you can detect whether Java is avaliable on the client's machine with the Plug-inCLSID
and then auto-download Java if necessary. The same support is available with Java Web Start technology by using the Java Web StartCLSID
. For more information, see Ensuring the Presence of the JRE Software in the Java Tutorials. - If you want to deploy extensions for your Java Web Start application, use the JNLP extension protocol mechanism. For more details, refer to the JNLP specification, section 3.8 'Extension Descriptor.'One advantage of the JNLP extensions mechanism over Java Plug-in technology is that the installed extensions will be available to all Java Web Start applications running on the system, no matter what version of JRE the application is running with. While for Java Plug-in technology, only applets running in the same JRE version can make use of the installed extensions.
- For signed JAR files, similar to Java Plug-in technology, you can sign your application JAR files and request your application to be run with all-permissions by means of the JNLP file. In Java Plug-in technology, your applet JARs can be signed by different certificates. In Java Web Start technology, the same certificate must be used to sign all JAR files (
jar
andnativelib
elements) that are part of a single JNLP file. This simplifies user management since only one certificate must be presented to the user during a launch per JNLP file. If you need to use JARs signed with different certificates, you can put them in a component extension JNLP file, and reference it from the main JNLP file. For more details, refer to the JNLP specification, section 5.4 'Signed Applications' and section 4.7 'Extension Resources.'
![Convert Jar File Jnlp Convert Jar File Jnlp](http://1.bp.blogspot.com/-SjGpuaXGXBc/WE9iydP6mHI/AAAAAAAABn8/RC6CCLggYZgTIweVMx6TWW3nMcFcG87BgCK4B/s1600/2.png)
Copyright © 1993, 2018, Oracle and/or its affiliates. All rights reserved.