Classpath
The classpath in Java defines the set of locations from which
classes and resources may be located and it defines the order
of the search.
In general, the order is important because the first match satisfies
the search.
In NetKernel, the Java classpath is context dependent and tightly managed.
This control allows NetKernel to provide many benefits, such as
module isolation and version management.
Each module in NetKernel has its own classloader. The dynamic
linking of modules creates a structured and ordered Java classpath.
A module classloader starts a local search for classes and then
progressively broadens the scope through the module context.
The NetKernel class and resource resolution order is as follows:
- The local module
- Any Jar files located in the local module's lib/ directory - order is not defined.
- The Java packages exported on the public interface
of any modules imported into the local module in order of import.
- The parent classloader - generally this is the module superstack context from which the currently
executing NetKernel request originated.
- The NetKernel core
- The [install]/lib/endorsed/ directory of the NetKernel installation.
- The Java Virtual Machine
Classpath Trace Tool
The classpath trace tool
can provide
detailed class resolution information for a given class in a specified module context.