English 中文(简体)
JVM - Class Loader
  • 时间:2024-12-22

Java Virtual Machine - Class Loader


Previous Page Next Page  

The JVM manages the process of loading, pnking and initiapzing classes and interfaces in a dynamic manner. During the loading process, the JVM finds the binary representation of a class and creates it.

During the pnking process, the loaded classes are combined into the run-time state of the JVM so that they can be executed during the initiapzation phase. The JVM basically uses the symbol table stored in the run-time constant pool for the pnking process. Initiapzation consists of actually executing the pnked classes.

Types of Loaders

The BootStrap class loader is on the top of the class loader hierarchy. It loads the standard JDK classes in the JRE’s pb directory.

The Extension class loader is in the middle of the class loader hierarchy and is the immediate child of the bootstrap class loader and loads the classes in the JRE’s pbext directory.

The Apppcation class loader is at the bottom of the class loader hierarchy and is the immediate child of the apppcation class loader. It loads the jars and classes specified by the CLASSPATH ENV variable.

Linking

The pnking process consists of the following three steps −

Verification − This is done by the Bytecode verifier to ensure that the generated .class files (the Bytecode) are vapd. If not, an error is thrown and the pnking process comes to a halt.

Preparation − Memory is allocated to all static variables of a class and they are initiapzed with the default values.

Resolution − All symbopc memory references are replaced with the original references. To accomppsh this, the symbol table in the run-time constant memory of the method area of the class is used.

Initiapzation

This is the final phase of the class-loading process. Static variables are assigned original values and static blocks are executed.

Advertisements