Java-deep Java Virtual Machine 2

Source: Internet
Author: User

class loader for two types of classes

-java the loader that comes with the virtual machine

Root ClassLoader (Bootstrap): Written in C + +, Programer can not abtain the This class.

Extension class loader (Extension): Using Java code to implement

System ClassLoader: Using Java code to implement

-user-defined class loader

Java.lang.ClassLoader Subclass: (Public abstract class ClassLoader)

Users can customize how classes are loaded:

 Packagepractise; Public classTestclassloader { Public Static voidMain (string[] args) {Class clz=NULL; Try{CLZ= Class.forName ("java.lang.String");        System.out.println (Clz.getclassloader ()); } Catch(ClassNotFoundException e) {//TODO auto-generated Catch blockE.printstacktrace (); } Class clz2=NULL; Try{CLZ2= Class.forName ("practise.c"); } Catch(ClassNotFoundException e) {//TODO auto-generated Catch blockE.printstacktrace ();            } System.out.println (Clz2.getclassloader ()); }}classc{}
NULL--->This shows that this is the root ClassLoader .
[EMAIL protected]---> This description is the application loader

The JVM specification allows the ClassLoader to preload a class when it is expected to be used, if it encounters a. Class in the pre-loaded process.

If the file is missing or there is an error, the ClassLoader must report an error when the program first actively uses the class.

After the class is loaded, it enters the connection phase, which merges the binary data of the classes that have been read into the memory into the runtime environment of the virtual machine.

The contents of the validation of the class:

-Result checking of class files

-Semantic Check

-byte code verification

-Verification of binary compatibility

Preparation phase of the class

Parsing of classes

Java-deep Java Virtual Machine 2

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.