Java class Loader

Source: Internet
Author: User

The class loader is primarily responsible for loading the compiled. class file

1 Java ClassLoader categories

ClassLoader

|--bootstrap ClassLoader (startup class loader)

|--extension classloader (Extension class loader)

|--system ClassLoader (System class loader)

|--user Custom ClassLoader (user-defined class loader)

    • Launch ClassLoader: Built in JVM boot, responsible for loading the Java Platform Core Library (Rt.jar)
    • Extension ClassLoader: The user loads the $java_home/lib/ext directory, or the class library under the directory specified by Java.ext.dirs. general public class library files are placed in an extended directory and loaded with the extension class loader
    • System ClassLoader: Loads the directories and jar files configured in the classpath, usually the Java classes we write are also loaded by the System class loader
    • User-defined class loader: User-defined load rule loading

There is no too much description for the user-defined ClassLoader (you need to learn more)

2 How the ClassLoader works

When loading A. class file, first try to load with system ClassLoader, and when system ClassLoader receives the load command, it first attempts to load with the parent class loader. The parent class tries to load with the parent class of parent ... and so on until Bootstrap ClassLoader. And then go back to the back to the first class loader that can load this. class file. If none are found, the classnotfoundexception will be thrown.

The workflow of the class loader can be described as follows:

Java class Loader

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.