20-CS-694 Advanced Programming Techniques Spring 2012

Interfaces, Exceptions, Graphics, Animation, Threads, Reflection, Networking, RMI, JDBC, JNI

       Previous     Next     All lectures


The CLASSPATH ONLY comprises directories that contain user-defined classes. The default value (what its value is when you open the box) is '.' (the current directory). It can be changed the usual way, for example using

  export CLASSPATH='.:/home/franco/Classes'
from the (BASH) command line or shell script. The so-called built-in classes are of two types: 'bootstrap classes' and 'extension classes'.

How the Java Launcher Finds Bootstrap Classes

       Bootstrap classes are the classes that implement the Java 2 Platform. Bootstrap classes are in the rt.jar and several other jar files in jre/lib directory. These archives are specified by the value of the bootstrap class path which 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 so in those rare cicrcumstances in which it is necessary to use a different set of core classes.

Note that the classes which implement the Java 2 SDK tools are in separate archive from the bootstrap classes. The tools archive is the SDK's/lib/tools.jar file. The development tools add this archive 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, use the original class path, not the augmented version.

How the Java Launcher Finds Extension Classes

       Extension classes are classes which extend the Java platform. Every .jar file in the extension directory, jre/lib/ext, is assumed to be an extension and is loaded using the Java Extension Framework. Loose class files in the extension directory will not be found. They must be contained in a .jar file (or .zip file). There is no option provided for changing the location of the extension directory.

If the jre/lib/ext directory contains multiple .jar files, and those files contain classes with the same name, such as:

    smart-extension1_0.jar contains class smart.extension.Smart
    smart-extension1_1.jar contains class smart.extension.Smart
the class that actually gets loaded is undefined.