Top Description Fields Constructors Methods
nonapi.io.github.classgraph.classpath

public final Class SystemJarFinder

extends Object
Class Inheritance
Imports
java.io.File, .IOException, java.util.LinkedHashSet, .Set, nonapi.io.github.classgraph.utils.FastPathResolver, .FileUtils, .JarUtils, .VersionFinder

A class to find rt.jar and any JRE "lib/" or "ext/" jars.

Field Summary

Modifier and TypeField and Description
private static final Set<String>
JRE_LIB_OR_EXT_JARS

The paths of any "lib/" or "ext/" jars found in the JRE.

private static final String
RT_JAR

The path of the first "rt.jar" found.

private static final Set<String>
RT_JARS

The paths of any "rt.jar" files found in the JRE.

Constructor Summary

AccessConstructor and Description
private
SystemJarFinder()

Constructor.

Method Summary

Modifier and TypeMethod and Description
private static boolean

Returns:

true if the directory was readable.
addJREPath
(final File
the JRE directory
dir
)

Add and search a JRE path.

public static Set<String>

Returns:

The paths for any jarfiles found in JRE/JDK "lib/" or "ext/" directories.
getJreLibOrExtJars
()

Get the JRE "lib/" and "ext/" jar paths.

public static String

Returns:

The path of rt.jar (in JDK 7 or 8), or null if it wasn't found (e.g. in JDK 9+).
getJreRtJarPath
()

Get the JRE "rt.jar" path.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

JRE_LIB_OR_EXT_JARSback to summary
private static final Set<String> JRE_LIB_OR_EXT_JARS

The paths of any "lib/" or "ext/" jars found in the JRE.

RT_JARback to summary
private static final String RT_JAR

The path of the first "rt.jar" found.

RT_JARSback to summary
private static final Set<String> RT_JARS

The paths of any "rt.jar" files found in the JRE.

Constructor Detail

SystemJarFinderback to summary
private SystemJarFinder()

Constructor.

Method Detail

addJREPathback to summary
private static boolean addJREPath(final File dir)

Add and search a JRE path.

Parameters
dir:File

the JRE directory

Returns:boolean

true if the directory was readable.

getJreLibOrExtJarsback to summary
public static Set<String> getJreLibOrExtJars()

Get the JRE "lib/" and "ext/" jar paths.

Returns:Set<String>

The paths for any jarfiles found in JRE/JDK "lib/" or "ext/" directories.

getJreRtJarPathback to summary
public static String getJreRtJarPath()

Get the JRE "rt.jar" path.

Returns:String

The path of rt.jar (in JDK 7 or 8), or null if it wasn't found (e.g. in JDK 9+).