Logo Search packages:      
Sourcecode: jamvm version File versions

static ClassLoader java::lang::ClassLoader::getSystemClassLoader (  )  [inline, static]

Returns the system classloader. The system classloader (also called the application classloader) is the classloader that was used to load the application classes on the classpath (given by the system property java.class.path. This is set as the context class loader for a thread. The system property java.system.class.loader, if defined, is taken to be the name of the class to use as the system class loader, which must have a public constructor which takes a ClassLoader as a parent; otherwise this uses gnu.java.lang.SystemClassLoader.

Note that this is different from the bootstrap classloader that actually loads all the real "system" classes (the bootstrap classloader is the parent of the returned system classloader).

A security check will be performed for RuntimePermission("getClassLoader") if the calling class is not a parent of the system class loader.

the system class loader
SecurityException if the security check fails
IllegalStateException if this is called recursively
Error if java.system.class.loader fails to load

Definition at line 711 of file ClassLoader.java.

References systemClassLoader.

    // Check if we may return the system classloader
    SecurityManager sm = System.getSecurityManager();
    if (sm != null)
      Class c = VMSecurityManager.getClassContext()[1];
      ClassLoader cl = c.getClassLoader();
      if (cl != null && cl != systemClassLoader)
        sm.checkPermission(new RuntimePermission("getClassLoader"));

    return systemClassLoader;

Generated by  Doxygen 1.6.0   Back to index