Java ClassLoader

Java ClassLoader

The ClassLoader class uses a delegation model to search for classes and resources. Each instance of ClassLoader has an associated parent class loader. When requested to find a class or resource, a ClassLoader instance will delegate the search for the class or resource to its parent class loader before attempting to find the class or resource itself. The virtual machine’s built-in class loader, called the “bootstrap class loader”, does not itself have a parent but may serve as the parent of a ClassLoader instance.

Bootstrap->
loadClass 根据 binary name 找 class 资源,
调findLoadedClass(name)检查class是否已被loaded,
如果loaded,
否则,
parent 是否未null,
否,则调用 parent.loadClass(name, false);
是,则调findBootstrapClassOrNull(name)

1
2
3
4
5
6
Loads the class with the specified **binary name**.
loadClass 根据
public Class<?> loadClass(String name) throws ClassNotFoundException {
return loadClass(name, false);
}


Subject1

subject1

list

  • item1
    content1
  • item2
    content2
  • item3
    content3

Subject2

subject2


参考

  • ref1
  • ref2
  • ref3