1 package com.java.classic7; 2 3 import java.net.URL; 4 5 import sun.misc.URLClassPath; 6 7 /** 8 * 9 * @author tao 10 *查看类加载器库 11 */ 12 public class Bootstrap { 13 14 public static void main(String[] args) { 15 //获取根类加载器加载的全部URL数组 16 URL[] urls = sun.misc.Launcher.getBootstrapClassPath().getURLs(); 17 //打印 18 for (int i = 0; i < urls.length; i++) { 19 System.out.println(urls[i].toExternalForm()); 20 } 21 } 22 23 }
1 URL[] urls = sun.misc.Launcher.getBootstrapClassPath().getURLs(); 这一句报错