4.6. URLClassLoader Details

The java.net.URLClassLoader class extends SecureClassLoader and is used to load classes and resources from a search path of URLs referring to both JAR files and directories. Here are the two constructors:

public URLClassLoader(URL[] urls, ClassLoader parent)
public URLClassLoader(URL[] urls)

The first method constructs a new URLClassLoader for the given URLs and assigns it parent as its delegation parent. The second method constructs a new URLClassLoader for the specified URLs, using the default delegation parent class loader, which is the application class loader. The URLs will be searched in the order specified for classes and resources but only after URLClassLoader first delegates to its parent by searching in ...

Get Inside Java™ 2 Platform Security: Architecture, API Design, and Implementation, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.