ClassGraph handles the following classpath and module path specification mechanisms:
Automatic-Module-Name
entry in the manifest file, or from the filename of the jar. (The module name is found by ClassGraph whether these jars are added to the module path or the traditional classpath.)META-INF/versions/X
, where X
is an integer greater than or equal to 9, and less than or equal to the running JVM version. (N.B. This requires the manifest file to contain the attribute Multi-Release: true
.)URLClassLoader
and subclasses.java.class.path
system property, supporting specification of the classpath using the -cp
JRE commandline switch.RestartClassLoader
for hot reload (though you will have to run a new scan on each restart).DefaultClassLoader
.war
and overlay mode.WebappClassLoaderBaseHandler
classloader.TomEEWebappClassLoader
and CxfContainerClassLoader
).ClassRealm
classloader.RuntimeClassLoader
.JarClassLoader
, and the (older, unmaintained) One-Jar JarClassLoader
.getClasspath()
, getClassPath()
, getURLs()
etc. (a number of method and field names are tried).lib/
or ext/
directories in the JDK or JRE (this is a rare but valid way to add classes to the classpath), or any other extension directories found in the java.ext.dirs
system property.
lib/
or ext/
directories (i.e. directories where jarfiles may be installed such that they are accessible to all installed JREs and JDKs):
/usr/java/packages
on Linux%SystemRoot%\Sun\Java\lib
, %SystemRoot%\Sun\Java\lib\ext
, %SystemRoot%\OracleJava\lib
, or %SystemRoot%\Oracle\Java\lib\ext
on Windows/System/Library/Java/Libraries
and /System/Library/Java/Extensions
on Mac OS X/usr/jdk/packages
on Solarishttp://
or https://
URLs. (Some ClassLoaders allow this.) This is disabled by default for security reasons. If .enableRemoteJarScanning()
is called before .scan()
, any remote jars are downloaded to a ByteBuffer
in RAM, or if the jar is too large, the jar is spilled over to a temporary file on disk. (Note that if your classpath contains remote jars, they will be downloaded every time the classpath is scanned. Both ClassGraph and the context ClassLoader may separately download the same jarfiles.).enableURLScheme("jimfs")
or similar. If a custom URI scheme is not backed by an underlying FileSystem
implementation, then URL.openConnection()
is used to open the URL. If the data fetched over the correction is large, it will automatically spill to a temporary file on disk.Jimfs
https://github.com/google/jimfs). Supports scanning a classpath URL of custom scheme (e.g. jimfs://
) via the NIO Files
and Path
APIs. This works for URLs that point to either a jarfile or to a directory (ClassGraph figures out which of these the URL points to). If you specify the URL path to a jarfile on a custom filesystem, it will be opened using FileChannel
for speed, rather than calling URL.openConnection()
.lib/*
(which includes all jars and directories in lib/
as separate classpath entries), which is allowed as of JDK 6. (Only whole-directory globs are currently supported, so lib/proj*
doesn't work, but this should match the JRE's behavior.)Class-Path
entries in a jarfile's manifest file, whereby jarfiles may add other external jarfiles to their own classpaths, with paths resolved relative to the parent directory or parent jarfile of the manifest's jarfile. ClassGraph is able to determine the transitive closure of these references, breaking cycles if necessary.Bundle-ClassPath
entries in an OSGi bundle jarfile's manifest file, which allows a bundle to add nested jars to the bundle classpath, with paths resolved relative to the root of the bundle jarfile.project.jar!/BOOT-INF/lib/dependency.jar
, as required by Spring-Boot, JBoss, and Felix classloaders, and probably others.
BOOT-INF/lib/
) without first extracting the inner jars to temporary files (the Java ZipFile
API is not capable of this).ByteBuffer
and array size limit of 2GB, by reading or mmap'ing large jarfiles in 2GB chunks, and seamlessly swapping in new chunks as needed.BOOT-INF/classes/
(Spring-Boot), WEB-INF/classes/
(Tomcat), and classes/
(Ant). (Note that the standard Java classloaders do not support this.)lib/
lib/ext/
BOOT-INF/lib/
BOOT-INF/lib-provided/
WEB-INF/lib/
WEB-INF/lib-provided/
META-INF/lib/
classes/
test-classes/
BOOT-INF/classes/
WEB-INF/classes/
PARENT_FIRST
and PARENT_LAST
classloader delegation modes (used by Websphere and Spring Boot), in order to resolve classpath elements in the correct order, mirroring the delegation order of the classloaders that the classpath elements were obtained from. (Standard Java classloaders use PARENT_FIRST
delegation.)You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4