[Class loader]

Class loading
When you want to use a class if the class has not yet been loaded into memory, the system by loading, connect, initialize three steps to achieve this class is initialized. load
Refers to the class file is read into memory, and whom to create a Class object.
Any class that is used when the system will build a Class object.
connection
Verify that the correct internal structure, and coordinated with other classes
Responsible for the preparation of a static class members to allocate memory and set the default initialization value
Parsing the binary data class is replaced symbolic references direct reference
initialization
What we've talked about initialization steps
 
Class initialization timing
Create an instance of the class
Access class static variable, or assign a static method call the class static variable
Reflection mode using force the creation of a class or interface initialization java.lang.Class objects corresponding to a subclass of a class
Direct use java.exe command to run a master class
 
Class loader
Responsible for loading the .class files to the internal and whom generate the corresponding Class object.
Although we do not care about class loading mechanism, but understand this mechanism we can run a better understanding of the program.
Composition class loader
Bootstrap ClassLoader root class loader
Extension ClassLoader extension classloader
Sysetm ClassLoader system class loader
 
Acting class loader
Bootstrap ClassLoader root class loader
Also known as the bootstrap class loader is responsible for loading Java core class
Such as System, String and so on. In rt.jar file under the JDK JRE's lib directory
Extension ClassLoader extension classloader
Responsible for loading the JRE extensions directory in a jar. JRE in the JDK ext directory under the lib directory
Sysetm ClassLoader system class loader
Responsible for loading class files from the java command, and classpath environment variable specified jar package and class path when JVM startup

Guess you like

Origin www.cnblogs.com/zuixinxian/p/11275203.html