java.lang.Object | +--java.lang.ClassLoader | +--java.security.SecureClassLoader | +--java.net.URLClassLoader
Untamed: This class loader is used to load classes and resources from a search path of URLs referring to both JAR files and directories. Any URL that ends with a '/' is assumed to refer to a directory. Otherwise, the URL is assumed to refer to a JAR file which will be opened as needed.
The AccessControlContext of the thread that created the instance of URLClassLoader will be used when subsequently loading classes and resources.
The classes that are loaded are by default granted permission only to access the URLs specified when the URLClassLoader was created.
URLClassLoader(URL[] urls)
ClassLoader.
URLClassLoader(URL[] urls,
ClassLoader parent)
URLClassLoader(URL[] urls,
ClassLoader parent,
URLStreamHandlerFactory factory)
protected void
addURL(URL url)
protected Package
definePackage(String name,
java.util.jar.Manifest man,
URL url)
protected Class
findClass(String name)
URL
findResource(String name)
Enumeration
findResources(String name)
protected PermissionCollection
getPermissions(CodeSource codesource)
static URLClassLoader
newInstance(URL[] urls)
static URLClassLoader
newInstance(URL[] urls,
ClassLoader parent)
clearAssertionStatus, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findSystemClass, getPackage, getPackages, getParent, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, loadClass, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
private sun.misc.URLClassPath ucp
private AccessControlContext acc
public URLClassLoader(URL[] urls, ClassLoader parent)
If there is a security manager, this method first
calls the security manager's checkCreateClassLoader method
to ensure creation of a class loader is allowed.
urls - the URLs from which to load classes and resourcesparent - the parent class loader for delegationSecurityManager.checkCreateClassLoader()public URLClassLoader(URL[] urls)
ClassLoader. The URLs will
be searched in the order specified for classes and resources after
first searching in the parent class loader. Any URL that ends with
a '/' is assumed to refer to a directory. Otherwise, the URL is
assumed to refer to a JAR file which will be downloaded and opened
as needed.
If there is a security manager, this method first
calls the security manager's checkCreateClassLoader method
to ensure creation of a class loader is allowed.
urls - the URLs from which to load classes and resourcesSecurityManager.checkCreateClassLoader()public URLClassLoader(URL[] urls, ClassLoader parent, URLStreamHandlerFactory factory)
If there is a security manager, this method first
calls the security manager's checkCreateClassLoader method
to ensure creation of a class loader is allowed.
urls - the URLs from which to load classes and resourcesparent - the parent class loader for delegationfactory - the URLStreamHandlerFactory to use when creating URLsSecurityManager.checkCreateClassLoader()protected void addURL(URL url)
url - the URL to be added to the search path of URLspublic URL[] getURLs()
protected Class findClass(String name) throws ClassNotFoundException
findClass in class ClassLoadername - the name of the class
ClassNotFoundExceptionprivate Class defineClass(String name, sun.misc.Resource res) throws IOException
protected Package definePackage(String name, java.util.jar.Manifest man, URL url) throws IllegalArgumentException
name - the package nameman - the Manifest containing package version and sealing
informationurl - the code source url for the package, or null if none
IllegalArgumentExceptionprivate boolean isSealed(String name, java.util.jar.Manifest man)
public URL findResource(String name)
findResource in class ClassLoadername - the name of the resource
URL for the resource, or null
if the resource could not be found.public Enumeration findResources(String name) throws IOException
findResources in class ClassLoadername - the resource name
Enumeration of URLs
IOException - if I/O errors occurprotected PermissionCollection getPermissions(CodeSource codesource)
If the protocol is "file" and the path specifies a file, then permission to read that file is granted. If protocol is "file" and the path is a directory, permission is granted to read all files and (recursively) all files and subdirectories contained in that directory.
If the protocol is not "file", then to connect to and accept connections from the URL's host is granted.
getPermissions in class SecureClassLoadercodesource - the codesource
public static URLClassLoader newInstance(URL[] urls, ClassLoader parent)
loadClass method of the URLClassLoader
returned by this method will invoke the
SecurityManager.checkPackageAccess method before
loading the class.
urls - the URLs to search for classes and resourcesparent - the parent class loader for delegation
public static URLClassLoader newInstance(URL[] urls)
loadClass method of the URLClassLoader
returned by this method will invoke the
SecurityManager.checkPackageAccess before
loading the class.
urls - the URLs to search for classes and resources