40 import java.security.CodeSource; 41 import java.security.Permission; 42 import java.security.PermissionCollection; 43 import sun.misc.Resource; 44 import sun.misc.URLClassPath; 45 import sun.net.www.ParseUtil; 46 import sun.security.util.SecurityConstants; 47 48 /** 49 * This class loader is used to load classes and resources from a search 50 * path of URLs referring to both JAR files and directories. Any URL that 51 * ends with a '/' is assumed to refer to a directory. Otherwise, the URL 52 * is assumed to refer to a JAR file which will be opened as needed. 53 * <p> 54 * The AccessControlContext of the thread that created the instance of 55 * URLClassLoader will be used when subsequently loading classes and 56 * resources. 57 * <p> 58 * The classes that are loaded are by default granted permission only to 59 * access the URLs specified when the URLClassLoader was created. 60 * 61 * @author David Connelly 62 * @since 1.2 63 */ 64 public class URLClassLoader extends SecureClassLoader implements Closeable { 65 /* The search path for classes and resources */ 66 private final URLClassPath ucp; 67 68 /* The context to be used when loading classes and resources */ 69 private final AccessControlContext acc; 70 71 /** 72 * Constructs a new URLClassLoader for the given URLs. The URLs will be 73 * searched in the order specified for classes and resources after first 74 * searching in the specified parent class loader. Any URL that ends with 75 * a '/' is assumed to refer to a directory. Otherwise, the URL is assumed 76 * to refer to a JAR file which will be downloaded and opened as needed. 77 * 78 * <p>If there is a security manager, this method first 79 * calls the security manager's {@code checkCreateClassLoader} method | 40 import java.security.CodeSource; 41 import java.security.Permission; 42 import java.security.PermissionCollection; 43 import sun.misc.Resource; 44 import sun.misc.URLClassPath; 45 import sun.net.www.ParseUtil; 46 import sun.security.util.SecurityConstants; 47 48 /** 49 * This class loader is used to load classes and resources from a search 50 * path of URLs referring to both JAR files and directories. Any URL that 51 * ends with a '/' is assumed to refer to a directory. Otherwise, the URL 52 * is assumed to refer to a JAR file which will be opened as needed. 53 * <p> 54 * The AccessControlContext of the thread that created the instance of 55 * URLClassLoader will be used when subsequently loading classes and 56 * resources. 57 * <p> 58 * The classes that are loaded are by default granted permission only to 59 * access the URLs specified when the URLClassLoader was created. 60 * <p> 61 * Where a JAR file contains the {@link Name#PROFILE Profile} attribute 62 * then its value is the name of the Java SE profile that the library 63 * minimally requires. If this runtime does not support the profile then 64 * it causes {@link java.util.jar.UnsupportedProfileException} to be 65 * thrown at some unspecified time. 66 * 67 * @author David Connelly 68 * @since 1.2 69 */ 70 public class URLClassLoader extends SecureClassLoader implements Closeable { 71 /* The search path for classes and resources */ 72 private final URLClassPath ucp; 73 74 /* The context to be used when loading classes and resources */ 75 private final AccessControlContext acc; 76 77 /** 78 * Constructs a new URLClassLoader for the given URLs. The URLs will be 79 * searched in the order specified for classes and resources after first 80 * searching in the specified parent class loader. Any URL that ends with 81 * a '/' is assumed to refer to a directory. Otherwise, the URL is assumed 82 * to refer to a JAR file which will be downloaded and opened as needed. 83 * 84 * <p>If there is a security manager, this method first 85 * calls the security manager's {@code checkCreateClassLoader} method |