Class Classpath


  • public class Classpath
    extends Object
    Encapsulates a classpath.
    Author:
    Nick Collier
    • Constructor Detail

      • Classpath

        public Classpath()
    • Method Detail

      • addEntry

        public boolean addEntry​(String entry)
        Adds the specified entry to the classpath. If the entry is a directory and it contains any .class files or its children of the directory contain any .class path the directory itself will be added. If the directory contains any jar files those will be added as well.

        If the entry ends with .jar that jar file will be added.

        Parameters:
        entry - the entry to add
        Returns:
        true if classes or jars were found and the entry was added, otherwise false.
      • addEntry

        public boolean addEntry​(ClassPathEntry entry)
        Adds the specified entry to the classpath. If the entry is a directory and it contains any .class files or its children of the directory contain any .class path the directory itself will be added. If the directory contains any jar files those will be added as well.

        If the entry ends with .jar that jar file will be added.

        Parameters:
        entry - the entry to add
        Returns:
        true if classes or jars were found and the entry was added, otherwise false.
      • entries

        public Iterable<ClassPathEntry> entries()
        Gets an iterable over all the classpath entries.
        Returns:
        an iterable over all the classpath entries.
      • classPaths

        public Iterable<File> classPaths()
        Gets an iterable over all the possible paths on which classes may be found. These include top level directories and jar files.
        Returns:
        an iterable over all the possible paths on which classes may be found. These include top level directories and jar files.