- public static void main(String[] args) {
- URL[] urLs = Launcher.getBootstrapClassPath().getURLs();
- System.out.println("启动类加载器加载的jar:");
- for (URL urL : urLs) {
- System.out.println("==> " + urL.toExternalForm());
- }
- printClassLoader("扩展类加载器和其加载的jar:", ClassLoaderJarPrint.class.getClassLoader().getParent());
- printClassLoader("应用类加载器和其加载的jar:", ClassLoaderJarPrint.class.getClassLoader());
- }
此处省略 ClassLoaderJarPrint#printClassLoader 的方法,我们通过断点的形式查看