如何在运行时判断标准扩展类加载器能加载哪些路径下的类?

 如何在运行时判断标准扩展类加载器能加载哪些路径下的类?

 

	public static void main(String[] args) {
	
		try {
			URL[] extURLs = ((URLClassLoader) ClassLoader
					.getSystemClassLoader().getParent()).getURLs();
			for (int i = 0; i < extURLs.length; i++) {
				System.out.println(extURLs[i]);
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

 输出:

file:/D:/Program%20Files/Java/jdk1.6.0_10/jre/lib/ext/dnsns.jar
file:/D:/Program%20Files/Java/jdk1.6.0_10/jre/lib/ext/localedata.jar
file:/D:/Program%20Files/Java/jdk1.6.0_10/jre/lib/ext/sunjce_provider.jar
file:/D:/Program%20Files/Java/jdk1.6.0_10/jre/lib/ext/sunmscapi.jar
file:/D:/Program%20Files/Java/jdk1.6.0_10/jre/lib/ext/sunpkcs11.jar
 

你可能感兴趣的:(java,ext)