java.lang
Class ClassLoader

java.lang.Object
  extended by java.lang.ClassLoader

public abstract class ClassLoader
extends Object

The ClassLoader is a way of customizing the way Java gets its classes and loads them into memory. The verifier and other standard Java things still run, but the ClassLoader is allowed great flexibility in determining where to get the classfiles and when to load and resolve them. For that matter, a custom ClassLoader can perform on-the-fly code generation or modification!

Every classloader has a parent classloader that is consulted before the 'child' classloader when classes or resources should be loaded. This is done to make sure that classes can be loaded from an hierarchy of multiple classloaders and classloaders do not accidentially redefine already loaded classes by classloaders higher in the hierarchy.

The grandparent of all classloaders is the bootstrap classloader, which loads all the standard system classes as implemented by GNU Classpath. The other special classloader is the system classloader (also called application classloader) that loads all classes from the CLASSPATH (java.class.path system property). The system classloader is responsible for finding the application classes from the classpath, and delegates all requests for the standard library classes to its parent the bootstrap classloader. Most programs will load all their classes through the system classloaders.

The bootstrap classloader in GNU Classpath is implemented as a couple of static (native) methods on the package private class java.lang.VMClassLoader, the system classloader is an instance of gnu.java.lang.SystemClassLoader (which is a subclass of java.net.URLClassLoader).

Users of a ClassLoader will normally just use the methods

Subclasses should implement the methods

Since:
1.0
See Also:
Class

Constructor Summary
protected ClassLoader(ClassLoader parent)
          Create a new ClassLoader with the specified parent.
 
Method Summary
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClassLoader

protected ClassLoader(ClassLoader parent)
Create a new ClassLoader with the specified parent. The parent will be consulted when a class or resource is requested through loadClass() or getResource(). Only when the parent classloader cannot provide the requested class or resource the findClass() or findResource() method of this classloader will be called. There may be a security check for checkCreateClassLoader.

Parameters:
parent - the classloader's parent, or null for the bootstrap classloader
Throws:
java.lang.SecurityException - if the security check fails
Since:
1.2