Module java.base
Package java.net

Class URLClassLoader

java.lang.Object
All Implemented Interfaces:
Closeable, AutoCloseable
Direct Known Subclasses:
MLet

public class URLClassLoader extends SecureClassLoader implements Closeable
This class loader is used to load classes and resources from a search path of URLs referring to both JAR files and directories. Any jar: scheme URL (see JarURLConnection) is assumed to refer to a JAR file. Any file: scheme 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.

This class loader supports the loading of classes and resources from the contents of a multi-release JAR file that is referred to by a given URL.

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.

Since:
1.2