Class PathClassLoader


  • public class PathClassLoader
    extends java.lang.ClassLoader
    A class loader for loading classes from a path of directories, zip files and jar files.
    • Constructor Summary

      Constructors 
      Constructor Description
      PathClassLoader​(java.io.File[] path)
      Create a PathCloader, specifying an array of files for the path.
      PathClassLoader​(java.io.File baseDir, java.lang.String pathString)
      Create a PathClassLoader, specifying a path and a base directory for any relative files on the path.
      PathClassLoader​(java.lang.String pathString)
      Create a PathClassLoader, specifying a path.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected java.lang.Class loadClass​(java.lang.String name, boolean resolve)
      Attempt to load a class if it is not already loaded, and optionally resolve any imports it might have.
      • Methods inherited from class java.lang.ClassLoader

        clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findClass, findLibrary, findLoadedClass, findResource, findResource, findResources, findSystemClass, getClassLoadingLock, getDefinedPackage, getDefinedPackages, getName, getPackage, getPackages, getParent, getPlatformClassLoader, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, getUnnamedModule, isRegisteredAsParallelCapable, 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

      • PathClassLoader

        public PathClassLoader​(java.lang.String pathString)
        Create a PathClassLoader, specifying a path.
        Parameters:
        pathString - a string containing a sequence of file paths separated by the platform-specific file separator, identifying a sequence of locations in which to look for classes to be loaded
        See Also:
        File.pathSeparator
      • PathClassLoader

        public PathClassLoader​(java.io.File baseDir,
                               java.lang.String pathString)
        Create a PathClassLoader, specifying a path and a base directory for any relative files on the path.
        Parameters:
        baseDir - the base directory for any relative files on the path
        pathString - a string containing a sequence of file paths separated by the platform-specific file separator, identifying a sequence of locations in which to look for classes to be loaded
        See Also:
        File.pathSeparator
      • PathClassLoader

        public PathClassLoader​(java.io.File[] path)
        Create a PathCloader, specifying an array of files for the path.
        Parameters:
        path - an array of files, identifying a sequence of locations in which to look for classes to be loaded
    • Method Detail

      • loadClass

        protected java.lang.Class loadClass​(java.lang.String name,
                                            boolean resolve)
                                     throws java.lang.ClassNotFoundException
        Attempt to load a class if it is not already loaded, and optionally resolve any imports it might have.
        Overrides:
        loadClass in class java.lang.ClassLoader
        Parameters:
        name - The fully-qualified name of the class to load.
        resolve - True if imports should be resolved, false otherwise.
        Returns:
        the class that was loaded
        Throws:
        java.lang.ClassNotFoundException - if the class was not found.