Class PathClassLoader

java.lang.Object
java.lang.ClassLoader
com.sun.javatest.util.PathClassLoader

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

    • PathClassLoader

      public PathClassLoader(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:
    • PathClassLoader

      public PathClassLoader(File baseDir, 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:
    • PathClassLoader

      public PathClassLoader(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 Details

    • loadClass

      protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException
      Attempt to load a class if it is not already loaded, and optionally resolve any imports it might have.
      Overrides:
      loadClass in class 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:
      ClassNotFoundException - if the class was not found.