The class loading of the JVM is done through ClassLoader and its subclasses, and the hierarchy and loading order of the classes can be described as follows:
1) Bootstrap ClassLoader/Start class loader
$JAVA _homeAll classes in JRE/lib/rt.jar, implemented by C + +, are not classloader subclasses
2) Extension classloader/Extension class loader
Some jar packages that are responsible for loading the extensions in the JAVA platform, including the jar packages in the specified directory of the JRE/lib/*.jar or-djava.ext.dirs in the $JAVA _home
3) App classloader/System class Loader
Responsible for documenting the jar packages specified in the Classpath and the class in the directory
4) Custom classloader/user-defined class loader (subclass of Java.lang.ClassLoader)
The ClassLoader that the application customizes according to its own needs, such as Tomcat and JBoss, will be implemented according to the Java EE specification itself ClassLoader
The load process checks to see if the class is loaded, the check order is bottom-up, and the custom ClassLoader to bootstrap ClassLoader-by-layer check, as long as a certain classloader is loaded as if the class has been loaded. Ensure that only all classloader of this class are loaded once. The order of loading is top-down, that is, the upper layer tries to load the class one at a level.
Introduction and analysis of class loading parental delegation mechanism
Here, it should be emphasized that the JVM defaults to the parent delegation mechanism when loading the class. In layman's words, when a particular class loader receives a request to load a class, it first delegates the load task to the parent class loader, recursively, and returns if the parent ClassLoader can complete the class load task, only to load itself when the parent ClassLoader cannot complete the load task.
Java Foundation-JVM class loading mechanism