首页 > 代码库 > 加载器
加载器
public static void main(String[] args) {// System.out.println(System.getProperty("sun.boot.class.path"));// System.out.println(System.getProperty("java.ext.dirs"));// System.out.println(System.getProperty("java.class.path")); System.out.println("BootstrapClassLoader 的加载路径: "); URL[] urls = sun.misc.Launcher.getBootstrapClassPath().getURLs(); for(URL url : urls) System.out.println(url); System.out.println("----------------------------"); //取得扩展类加载器 URLClassLoader extClassLoader = (URLClassLoader)ClassLoader.getSystemClassLoader().getParent(); System.out.println(extClassLoader); System.out.println("扩展类加载器 的加载路径: "); urls = extClassLoader.getURLs(); for(URL url : urls) System.out.println(url); System.out.println("----------------------------"); //取得应用(系统)类加载器 URLClassLoader appClassLoader = (URLClassLoader)ClassLoader.getSystemClassLoader(); System.out.println(appClassLoader); System.out.println("应用(系统)类加载器 的加载路径: "); urls = appClassLoader.getURLs(); for(URL url : urls) System.out.println(url); System.out.println("----------------------------"); }
BootstrapClassLoader 的加载路径: file:/C:/Program%20Files/Java/jdk1.8.0_91/jre/lib/resources.jarfile:/C:/Program%20Files/Java/jdk1.8.0_91/jre/lib/rt.jarfile:/C:/Program%20Files/Java/jdk1.8.0_91/jre/lib/sunrsasign.jarfile:/C:/Program%20Files/Java/jdk1.8.0_91/jre/lib/jsse.jarfile:/C:/Program%20Files/Java/jdk1.8.0_91/jre/lib/jce.jarfile:/C:/Program%20Files/Java/jdk1.8.0_91/jre/lib/charsets.jarfile:/C:/Program%20Files/Java/jdk1.8.0_91/jre/lib/jfr.jarfile:/C:/Program%20Files/Java/jdk1.8.0_91/jre/classes----------------------------sun.misc.Launcher$ExtClassLoader@5e481248扩展类加载器 的加载路径: file:/C:/Program%20Files/Java/jdk1.8.0_91/jre/lib/ext/access-bridge-64.jarfile:/C:/Program%20Files/Java/jdk1.8.0_91/jre/lib/ext/cldrdata.jarfile:/C:/Program%20Files/Java/jdk1.8.0_91/jre/lib/ext/dnsns.jarfile:/C:/Program%20Files/Java/jdk1.8.0_91/jre/lib/ext/jaccess.jarfile:/C:/Program%20Files/Java/jdk1.8.0_91/jre/lib/ext/jfxrt.jarfile:/C:/Program%20Files/Java/jdk1.8.0_91/jre/lib/ext/localedata.jarfile:/C:/Program%20Files/Java/jdk1.8.0_91/jre/lib/ext/nashorn.jarfile:/C:/Program%20Files/Java/jdk1.8.0_91/jre/lib/ext/sunec.jarfile:/C:/Program%20Files/Java/jdk1.8.0_91/jre/lib/ext/sunjce_provider.jarfile:/C:/Program%20Files/Java/jdk1.8.0_91/jre/lib/ext/sunmscapi.jarfile:/C:/Program%20Files/Java/jdk1.8.0_91/jre/lib/ext/sunpkcs11.jarfile:/C:/Program%20Files/Java/jdk1.8.0_91/jre/lib/ext/zipfs.jar----------------------------sun.misc.Launcher$AppClassLoader@1d44bcfa
应用(系统)类加载器 的加载路径:
这里就打印的jar是系统的classpath路径:System.getProperty("java.class.path");
即WEB-INF/classes/里面的class文件 和 项目引用的jar
加载器
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。