Logo Search packages:      
Sourcecode: jamvm version File versions

java::lang::ClassLoader Class Reference

List of all members.


Detailed Description

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

Author:
John Keiser

Mark Wielaard

Eric Blake <ebb9@email.byu.edu>

See also:
Class
Since:
1.0 still missing 1.4 functionality

Definition at line 117 of file ClassLoader.java.


Public Member Functions

synchronized void clearAssertionStatus ()
final ClassLoader getParent ()
URL getResource (String name)
InputStream getResourceAsStream (String name)
final Enumeration getResources (String name) throws IOException
Class loadClass (String name) throws ClassNotFoundException
synchronized void setClassAssertionStatus (String name, boolean enabled)
void setDefaultAssertionStatus (boolean enabled)
synchronized void setPackageAssertionStatus (String name, boolean enabled)

Static Public Member Functions

static ClassLoader getSystemClassLoader ()
static final URL getSystemResource (String name)
static final InputStream getSystemResourceAsStream (String name)
static Enumeration getSystemResources (String name) throws IOException

Protected Member Functions

 ClassLoader (ClassLoader parent)
 ClassLoader () throws SecurityException
final synchronized Class defineClass (String name, byte[] data, int offset, int len, ProtectionDomain domain) throws ClassFormatError
final Class defineClass (String name, byte[] data, int offset, int len) throws ClassFormatError
final Class defineClass (byte[] data, int offset, int len) throws ClassFormatError
Package definePackage (String name, String specTitle, String specVendor, String specVersion, String implTitle, String implVendor, String implVersion, URL sealed)
Class findClass (String name) throws ClassNotFoundException
String findLibrary (String name)
final synchronized Class findLoadedClass (String name)
URL findResource (String name)
Enumeration findResources (String name) throws IOException
final Class findSystemClass (String name) throws ClassNotFoundException
Package getPackage (String name)
Package[] getPackages ()
synchronized Class loadClass (String name, boolean resolve) throws ClassNotFoundException
final void resolveClass (Class c)
final void setSigners (Class c, Object[] signers)

Package Functions

final boolean isAncestorOf (ClassLoader loader)

Static Package Functions

 [static initializer]

Package Attributes

Map classAssertionStatus
boolean defaultAssertionStatus = VMClassLoader.defaultAssertionStatus()
final Map definedPackages = new HashMap()
Map packageAssertionStatus

Static Package Attributes

static final ProtectionDomain defaultProtectionDomain
static final Map systemClassAssertionStatus = VMClassLoader.classAssertionStatus()
static final ClassLoader systemClassLoader
static final Map systemPackageAssertionStatus = VMClassLoader.packageAssertionStatus()

Private Attributes

final boolean initialized
final ClassLoader parent

The documentation for this class was generated from the following file:

Generated by  Doxygen 1.6.0   Back to index