Closes this URLClassLoader, so that it can no longer be used to load new classes or resources that are defined by this loader. Classes and resources defined by any of this loader's parents in the delegation hierarchy are still accessible. Also, any classes or resources that are already loaded, are still accessible.
In the case of jar: and file: URLs, it also closes any files
that were opened by it. If another thread is loading a
class when the close
method is invoked, then the result of
that load is undefined.
The method makes a best effort attempt to close all opened files,
by catching IOException
s internally. Unchecked exceptions
and errors are not caught. Calling close on an already closed
loader has no effect.
IOException | if closing any file opened by this class loader resulted in an IOException. Any such exceptions are caught internally. If only one is caught, then it is re-thrown. If more than one exception is caught, then the second and following exceptions are added as suppressed exceptions of the first one caught, which is then re-thrown. |
Finds and loads the class with the specified name from the URL search path. Any URLs referring to JAR files are loaded and opened as needed until the class is found.
name | the name of the class |
ClassNotFoundException | if the class could not be found, or if the loader is closed. |
Returns the permissions for the given codesource object. The implementation of this method first calls super.getPermissions and then adds permissions based on the URL of the codesource.
If the protocol of this URL is "jar", then the permission granted is based on the permission that is required by the URL of the Jar file.
If the protocol is "file" and there is an authority component, then permission to connect to and accept connections from that authority may be granted. 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 permission to connect to and accept connections from the URL's host is granted.
codesource | the codesource |
Returns an input stream for reading the specified resource. If this loader is closed, then any resources opened by this method will be closed.
The search order is described in the documentation for getResource(String)
.
null
if the resource could not be found
Diagram: ClassLoader