I am studying the loading process of the jvm class and found out the following fact:
The class loader subsystem uses the delegation hierarchy algorithm. It will search along the path from the path BootStrap → path extension → Application path.
Then I want to "try" this in real code, as shown below:
create class A and class B; Class A with main () method and type B variable.
after compilation, I used the jar command to get the jar file of class B from B.class, then delete the B.class file, put the B.jar file in jdk / jre / lib / ext (Since the oracle document says that extClassLoader will not look for which any free cool file in jdk / jre / lib / ext).
Result of ClassNotFoundException.so My question is:
1) Does jvm not allow loading custom clasfile from BootStrap and extension class paths?
2) if so, why load it using the delegation hierarchy algorithm, which seems to lead to low efficiency?
tks ....
source
share