Assuming the JDK software is installed at
c:\jdk1.2beta4
, here are the crucial directories
and why they
are important:
In previous releases, a single archive,
c:\jdk1.2beta4
- The root directory of the JDK software installation. Contains copyright, license, and README files.
c:\jdk1.2beta4\bin
- The executable files for the development tools. The PATH environment variable should contain an entry for this directory.
c:\jdk1.2beta4\lib
- Files used by the development tools. These include
tools.jar
, which contains classes and resources required to run the development tools.
c:\jdk1.2beta4\jre
- The root directory of the "private" Java runtime environment used by the JDK development tools. The runtime environment is an implementation of the Java 1.2 platform.
c:\jdk1.2beta4\jre\bin
- Executable files for the java and rmiregistry tools and
.dll
libraries used by the Java platform. The filesjava.exe
andrmiregistry.exe
are identical to files inc:\jdk1.2beta4\bin
. Here, the java launcher tool serves as a deployment launcher, in place of the old jre tool. This directory does not need to be in the PATH environment variable.
c:\jdk1.2beta4\jre\bin\classic
- Files that implement a "classic" Java virtual machine.
c:\jdk1.2beta4\jre\lib
- Code ibraries, property settings, and resource files used by the Java runtime environment. These include
rt.jar
, which contains the bootstrap classes. Aside from theext
subdirectory (described below) there are several resource subdirectories not described here.
c:\jdk1.2beta4\jre\lib\ext
- Default installation directory for Extensions.
c:\jdk1.2beta4\jre\lib\security
- Contains files used for security management. These include the security policy (
java.policy
) and security properties (java.security
) files.
classes.zip
,
contained both tool classes and bootstrap classes. These classes are
now divided between tool.jar
and rt.jar
.
Here's a set command example setting the CLASSPATH environment variable:
set CLASSPATH=c:\myclasses;.Never put spaces directly before or after the equals sign:
set CLASSPATH = c:\myclasses;.These spaces will be interpreted as part of the variable name or value!
For a summary of environment variables used by JDK software, see
Installation and Configuration. For
specifics on the CLASSPATH environment variable, see the next
section.
HOW THE JAVA LAUNCHER FINDS USER CLASSES
User classes are classes which build on the Java platform. To find
user classes, the launcher refers to the user class path, a list of
directories, JAR archives, and ZIP archives
containing class files.
A class file has a subpath name that reflects the class's
full-qualified name. For example, suppose the class
com.mypackage.MyClass
is stored under
c:\myclasses
, and c:\myclasses
is in the
user class path. Then the class file must be
c:\myclasses\com\mypackage\MyClass.class
. If this same
class is defined in an archive named myclasses.jar
, then
myclasses.jar
must be in the user class path, and the class
file must be stored in the archive as
com\mypackage\MyClass.class
.
On Win32, the user class path is specified as a string, with a semicolon
(;
) separating the class path entries. The
java launcher puts the user class path string in the
java.class.path
system property. The possible sources of
this value are, in increasing order of precedence:
.
", meaning that all
user class files are under the current directory.
c:\jdk1.2beta4\jre\lib
: rt.jar
,
i18n.jar
. To find the system classes, the runtime
refers to a bootstrap class path, similar to the the user class
Path described above. The value of the bootstrap class path is stored in
the sun.boot.class.path
system property. This system
property is for reference only, and should not be directly modified.
It is very unlikely that you will need to redefine the bootstrap class path. The nonstandard option, -Xbootclasspath, allows you to do this.
Note that the classes which implement the JDK development tools are
in separate archive from the bootstrap classes.
(In the above example, the tools archive is
c:\jdk1.2beta4\lib\tools.jar
.) The development tools add
tools.jar
to the user class path when invoking the
launcher. However, this augmented user class path is only used to
execute the tool. The tools that process source code, javac and
javadoc refer to the original user class path. See
How Javac and Javadoc Find Classes, below.
HOW THE JAVA LAUNCHER FINDS EXTENSION
CLASSES
Every .jar
file in the extension directory is assumed to
be a Extension and loaded using the
Java
Extension Framework. There is no option provided for changing
the location of the extension directory.
SEARCH ORDER FOR CLASSES
When resolving a class name, the runtime searches first in the
bootstrap class Path, then each Extension, then in the user class
path.
In effect, these three parts are joined to form a simple class path. This is similar to the "flat" class path previously used. The current model has some important differences:
java.class.path
system property.
A program can load a class or interface by calling the loadClass method of a class loader object. But usually a program loads a class or interface simply by referring to it. This invokes an internal class loader, which can apply a security policy to extension and user classes. If the security policy has not been enabled, all classes are "trusted". Even if the security policy is enabled, it does not apply to bootstrap classes, which are always "trusted."
When enabled, security policy is configured by system and user policy files. The JDK software includes a system policy file that grants "trusted" status to extension classes and places basic restrictions on user classes.
To enable or configure the security policy, refer to Security Features.
Some security programming techniques that worked with the Java 1.1
platform are incompatible with the 1.2 class loading model. To provide
temporary support for existing code, this release includes the
oldjava launcher, which uses the 1.1 class loading model.
HOW JAVAC AND JAVADOC FIND CLASSES
The javac and javadoc tools use class files in two
distinct ways:
tools.jar
are only used to
run javac and javadoc. The tools classes are not used
to resolve source code references unless tool.jar
is
in the user class path.
By default, javac and javadoc search the user class path
for both class files and source code files.
If the -sourcepath option is specified,
javac and javadoc search only the specified source file
path.
SEE ALSO