work hard work smart

专注于Java后端开发。 不断总结,举一反三。
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

JVM 扩展类加载器1

Posted on 2019-06-15 18:25  work hard work smart  阅读(253)  评论(0编辑  收藏  举报

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=./

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