Class PublicURLClassLoader

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable

    public class PublicURLClassLoader
    extends java.net.URLClassLoader
    • Constructor Summary

      Constructors 
      Constructor Description
      PublicURLClassLoader​(java.net.URL[] urls)
      Constructs a new URLClassLoader for the specified URLs using the default delegation parent ClassLoader.
      PublicURLClassLoader​(java.net.URL[] urls, java.lang.ClassLoader parent)
      Constructs a new URLClassLoader for the given URLs.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addURL​(java.net.URL url)  
      • Methods inherited from class java.net.URLClassLoader

        close, definePackage, findClass, findResource, findResources, getPermissions, getResourceAsStream, getURLs, newInstance, newInstance
      • Methods inherited from class java.security.SecureClassLoader

        defineClass, defineClass
      • Methods inherited from class java.lang.ClassLoader

        clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findSystemClass, getClassLoadingLock, getDefinedPackage, getDefinedPackages, getName, getPackage, getPackages, getParent, getPlatformClassLoader, getResource, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, getUnnamedModule, isRegisteredAsParallelCapable, loadClass, loadClass, registerAsParallelCapable, resolveClass, resources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PublicURLClassLoader

        public PublicURLClassLoader​(java.net.URL[] urls)
        Constructs a new URLClassLoader for the specified URLs using the default delegation parent 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.

        Parameters:
        urls - the URLs from which to load classes and resources
        Throws:
        java.lang.SecurityException - if a security manager exists and its checkCreateClassLoader method doesn't allow creation of a class loader.
        java.lang.NullPointerException - if urls is null.
        See Also:
        SecurityManager.checkCreateClassLoader()
      • PublicURLClassLoader

        public PublicURLClassLoader​(java.net.URL[] urls,
                                    java.lang.ClassLoader parent)
        Constructs a new URLClassLoader for the given URLs. The URLs will be searched in the order specified for classes and resources after first searching in the specified parent class loader. Any jar: scheme URL 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 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.

        Parameters:
        urls - the URLs from which to load classes and resources
        parent - the parent class loader for delegation
        Throws:
        java.lang.SecurityException - if a security manager exists and its checkCreateClassLoader method doesn't allow creation of a class loader.
        java.lang.NullPointerException - if urls is null.
        See Also:
        SecurityManager.checkCreateClassLoader()
    • Method Detail

      • addURL

        public void addURL​(java.net.URL url)
        Overrides:
        addURL in class java.net.URLClassLoader