JVM 扩展类加载应用

1、创建类

public class MyTest19 {

    public static void main(String[] args) throws  Exception {

        System.out.println(AESKeyGenerator.class.getClassLoader());
        System.out.println(MyTest19.class.getClassLoader());

    }
}

  查看打印结果

sun.misc.Launcher$ExtClassLoader@29453f44
sun.misc.Launcher$AppClassLoader@18b4aac2

  说明AESKeyGenerator类是由扩展加载器加载的。

 修改扩展加载器的加载路径为当前路径

-Djava.ext.dirs=./

再次打印,结果会抛出异常。

猜你喜欢

转载自www.cnblogs.com/linlf03/p/11028446.html