Note: Java Extensions are also referred to as Optional Packages.
This section covers the following topics:
Java applets may use various Java Extensions to provide certain functions to users. Deploying Java Extensions dynamically with Java applets in Java Plug-in have been a challenge to developers, especially those with thousands of machines in an intranet/Internet environment.
Java Extensions Installation enables various Java Extensions (e.g., JavaHelp, Java3D ...) to be deployed and installed easily along with Java applets in the Java 2 Runtime Environment. This document outlines the basic steps for deploying Installed Java Extensions in Java Plug-in. For details about how Java Extensions works, please see the Java Extensions Mechanism documentation in Java 2.
To use Java Extensions Installation in Java Plug-in, information about the extensions must be specified in three places:
Note: For an explanation of version numbers, see
the note in the section called "Using
OBJECT
, EMBED
and APPLET
Tags in Java
Plug-in."
To deploy Java Extensions with applets, the applet must be packaged as a JAR file. The MANIFEST file of the applet must contain proper information about the Java Extensions to be installed, according to the Extension Versioning Specification. For example,
Extension-List: RectangleArea RectanglePerimeter RectangleArea-Extension-Name: com.mycompany.RectangleArea RectangleArea-Specification-Version: 1.2 RectangleArea-Implementation-Version: 1.2 RectangleArea-Implementation-Vendor-Id: com.mycompany RectangleArea-Implementation-URL: http://mycompany.com/RectangleArea.jar RectanglePerimeter-Extension-Name: com.mycompany.RectanglePerimeter RectanglePerimeter-Specification-Version: 1.2 RectanglePerimeter-Implementation-Version: 1.2 RectanglePerimeter-Implementation-Vendor-Id: com.mycompany RectanglePerimeter-Implementation-URL: http://mycompany.com/RectanglePerimeter.jarIn this example, two extensions are deployed with the applet - RectangleArea and RectanglePerimeter. If they have not been installed or if updates are needed, the proper version will be downloaded from Implementation-URL. Notice that the Implementation-URL must point to a JAR file which is the Java Extensions Installation.
Three types of Java Extensions Installation are supported in Java Plug-in:
To ensure the Java Extensions Installations are downloaded and installed properly, they must be bundled as JAR files and be specified as Implementation-URL in the applet's MANIFEST. Each Java Extensions itself must be bundled as JAR files and contain proper versioning information in its own MANIFEST file according to the Extension Versioning Specification. For example,
Extension-Name: javax.help Specification-Vendor: Sun Microsystems, Inc Specification-Version: 1.0 Implementation-Vendor-Id: com.sun Implementation-Vendor: Sun Microsystems, Inc Implementation-Version: 1.0In this case, it will be recognized as a raw Java Extension, and will be copied into the lib/ext directory directly.
Extension-Name: javax.help Specification-Vendor: Sun Microsystems, Inc Specification-Version: 1.0 Implementation-Vendor-Id: com.sun Implementation-Vendor: Sun Microsystems, Inc Implementation-Version: 1.0 Main-Class: com.sun.javahelp.installerIn this case, because Main-Class is present in the MANIFEST, it will be treated as Java Installer, and the main-class will be invoked. It is the job of the Java Installer to copy the Java Extensions into the proper lib/ext directory. However, each Java Extension being copied into the lib/ext directory MUST contain proper versioning information as well. For example,
Extension-Name: javax.help Specification-Vendor: Sun Microsystems, Inc Specification-Version: 1.0 Implementation-Vendor-Id: com.sun Implementation-Vendor: Sun Microsystems, Inc Implementation-Version: 1.0
This ensures the versioning information of the extensions can be determined by looking in the MANIFEST file of all the JAR files in the lib/ext directory.
Extension-Name: javax.help Specification-Vendor: Sun Microsystems, Inc Specification-Version: 1.0 Implementation-Vendor-Id: com.sun Implementation-Vendor: Sun Microsystems, Inc Implementation-Version: 1.0 Extension-Installation: installer.exeIn this case, because Extension-Installation is present in the MANIFEST, it will be treated as a native Installer, and the installer itself will be launched. It is the job of the native Installer to copy the Java Extensions into the proper lib/ext directory. However, similar to the Java installer case, each Java Extension being copied into the lib/ext directory MUST contain proper versioning information as well. For example,
Extension-Name: javax.help Specification-Vendor: Sun Microsystems, Inc Specification-Version: 1.0 Implementation-Vendor-Id: com.sun Implementation-Vendor: Sun Microsystems, Inc Implementation-Version: 1.0
This ensures the versioning information of the extensions can be determined by looking in the MANIFEST file of all the JAR files in the lib/ext directory.
To deploy Java Extensions with Java applets, these steps must be followed:
When the applet is deployed with Java Extensions, the Java Extensions information stored in the applet's MANIFEST file will be examined. The extension update algorithm is based on the one described in the Extension Versioning Specification. If an update is required, the Java Extensions Installation will be downloaded and verified to ensure that the extension is correctly signed. If it is valid, the Plug-in will pop-up a security dialog that provides three options:
Once the user selects the options from the security dialog, the extensions
installation will be executed in the corresponding security context. The applet
will not be started until the extensions are properly installed to ensure that
the extensions installation is as seamless as possible.
Because Java Extensions are downloaded and installed into the Java 2 Runtime lib/ext directory, each Java Extensions Installation must be signed. Once the Java Extensions are installed, it will have the proper permissions that are granted to Java Extensions through the policy file.