JDK 8 和 JDK 11 的base 和 ext 相关类的加载机制不同?
JDK 8 和 JDK 11 的base 和 ext 相关类的加载机制不同?
如图所示,代码是JVM调优第一节课中的示例代码,
public class TestJDKClassLoader {
public static void main(String[] args) {
System.out.println(String.class.getClassLoader());
System.out.println(TestJDKClassLoader.class.getClassLoader().getName());
System.out.println(DESKeyFactory.class.getClassLoader().getClass().getName());
}
}
没有任何不同,在jdk11 下运行出来的结果是这样:
null
app
Exception in thread "main" java.lang.NullPointerException
at com.fwl.jvm.TestJDKClassLoader.main(TestJDKClassLoader.java:11)
Process finished with exit code 1
这是为什么?
0 个回答
暂无回答