Class SystemJarFinder

java.lang.Object
nonapi.io.github.classgraph.classpath.SystemJarFinder

public final class SystemJarFinder extends Object
A class to find rt.jar and any JRE "lib/" or "ext/" jars.
  • Field Details

    • RT_JARS

      private static final Set<String> RT_JARS
      The paths of any "rt.jar" files found in the JRE.
    • RT_JAR

      private static final String RT_JAR
      The path of the first "rt.jar" found.
    • JRE_LIB_OR_EXT_JARS

      private static final Set<String> JRE_LIB_OR_EXT_JARS
      The paths of any "lib/" or "ext/" jars found in the JRE.
  • Constructor Details

    • SystemJarFinder

      private SystemJarFinder()
      Constructor.
  • Method Details

    • addJREPath

      private static boolean addJREPath(File dir)
      Add and search a JRE path.
      Parameters:
      dir - the JRE directory
      Returns:
      true if the directory was readable.
    • getJreRtJarPath

      public static String getJreRtJarPath()
      Get the JRE "rt.jar" path.
      Returns:
      The path of rt.jar (in JDK 7 or 8), or null if it wasn't found (e.g. in JDK 9+).
    • getJreLibOrExtJars

      public static Set<String> getJreLibOrExtJars()
      Get the JRE "lib/" and "ext/" jar paths.
      Returns:
      The paths for any jarfiles found in JRE/JDK "lib/" or "ext/" directories.