Classloader
Java 内置 Class Loader
· ☕ 3 分钟

内置 Classloader

The class loader delegation model

Class loaders load classes and resources present on their respective classpath:

  • System or application class loaders load classes from the application classpath
  • Extension class loaders search on the Extension classpath (JRE/lib/ext)
  • Bootstrap class loader looks on the Bootstrap classpath (JRE/lib/rt.jar)

We can customize the default class loading behavior as well. We can explicitly specify the class loader while loading a class dynamically.

However, we should note that if we load the same class from different types of class loaders, these will be seen as different resources by the JVM.