Extensions - An Overview
Extensions are embodied in JAR files, and every JAR file is a potential extension. A JAR file can be made to play the role of an extension in two ways:
The jre directory can be either the top-level directory of the Java Runtime Environment or the jre directory in the JDK software directory hierarchy. Classes within JAR files in this directory can be used by applets and applications much as if they were part of the set of bootstrap classes, without having to explicitly include them in the class path.jre/lib/ext
An installed extension's native code binaries, if any, are placed in
wherejre\bin [Win32] jre/lib/<arch> [Solaris]
<arch>is the Solaris processor architecture, either
i386. Native libraries may also be placed in jre/lib/ext/<arch> for both Win32 and Solaris, where <arch> will be i386 on Win32 systems. The jre/lib/ext/<arch> directory is searched after jre\bin (win32) or jre/lib/<arch> (Solaris).
When the Java VM
encounters a class name, it looks first for the class in the set
of bootstrap classes. If it fails to find the desired class among
the system classes, the VM will then search for the class in any JAR files
Note that there is nothing special about any particular JAR file
itself or the classes it contains that makes it an installed extension.
It is an installed extension by virtue of its location in
If a class is not found after searching both the system classes and the classes in the installed extensions, the extension mechanism will search for the class in a download extension....
A Class-Path header might look like this, for example:
This specifies that the classes in the filesClass-Path: servlet.jar infobus.jar acme/beans.jar
acme/beans.jarwill serve as extensions for purposes of the classes in the JAR file whose manifest contains this header. The URLs in the Class-Path field are given relative to the URL of the JAR file of the applet or application.
Unlike the case of installed extensions, the location of the JAR files that serve as download extensions is irrelevent. A download extension is an extension because it is specified as the value of the Class-Path header in another JAR file's manifest, not because it has any particular location.
Another difference between installed and download extensions is that only applets and applications bundled in a JAR file can make use of download extensions. Applets and applications not bundled in a JAR file don't have a manifest from which to reference download extensions.
When searching for a class, the VM first searches among the classes in the system classes and in any installed extensions. If the class is not found in either the system classes or in the installed extensions, the VM will search for the class in any download extensions referenced by the manifest of the application or applet. A download extension will not be downloaded if a desired class is found among the installed extensions, even if the download extension is referenced by the manifest file of the applet or application.
The extension mechanism will not install a download extension in the JRE or JDK directory structure. Download extensions do not become installed extentions after they have once been downloaded.
Unlike installed extensions, download extensions cannot have any native code.
Considerations when making an installed extension
There are several points to consider when you want to turn your
classes into an extension.
|Copyright © 1997, 1998 Sun Microsystems, Inc. All Rights Reserved.||