University of Cincinnati logo and link  
Class Loader
 
  UC ingot It is the job of the class loader to find the classes that the Java Virtual Machine (JVM) will run.  To do this, it must:
    • Find the initial class, either by the web or on a local or network disk drive.
    • Find any superclasses for the initial class.
    • Run the static main method of the requested class.
    • Run any other classes that are called during the execution of the program, including those called from main.
  • Every Java program has at least three class loaders:
    • The bootstrap class loader, which loads the system classes.  Since this is often written in a machine native language, there is no ClassLoader object for this class loader.
    • The extension class loader, which loads classes and jars from jre/lib/ext, whether or not they are specifically in the class path.
    • The system, or application, class loader loads the application classes from the classpath.
  • The boostrap class loader is the top level class loader.  All other class loaders are children of bootstrap or another class loader (which, at some point, is a child of boostrap).  The highest level class loader is given the first shot at loading the class, then the next child tries if its parent cannot, and so on, until the class is loaded.
  • You can write your own class loader to implement custom security checks.
  • If you have two classes with the same name and the same package name, say, from two different vendors, you can use the class loader to identify the class you want.
 Verifier