Table of Contents 1. Overview 2. Simple procedure 3. Class loader each searches for directory 4. Class Loader features 5. Class loader get 6. Load of Class
1. Overview
Class loading is the first step in a Java program, and studying the loading of classes can help you understand the JVM execution process and instruct developers to take more effective steps to match the program execution. The second purpose of the research class loading mechanism is to enable the program to dynamically control class loading, such as thermal deployment, to improve the flexibility and adaptability of the program.
2. Simple process
When executing the command ' Java Hello ' at the command line, the JVM loads the ' hello.class ' file into memory and produces a ' class ' object ' Hello.class ', which is the process ' loading process ':
2.1 First find the ' Jvm.dll ' in the JRE directory, my machine is ' <jdk installation Path>\jre\bin\server\jvm.dll ', and initialize the JVM;
2.2 Generate a bootstrap Loader (launcher loader);
2.3 Bootstrap Loader automatically loads extended Loader (Standard extension class loader) and sets Bootstrap Loader to its parent Loader.
2.4 Bootstrap Loader automatically loads Appclass Loader (System ClassLoader) and sets extended Loader to its parent Loader.
2.5 Finally the HelloWorld class is loaded by Appclass loader.
The above is the general process of loading Java classes.
Java class loading mechanism