jdeps - launch the Java class dependency analyzer
jdeps [options] path ...
Command-line options. For detailed descriptions of the options that can be used, see
.class file, directory, or JAR file to analyze.
The jdeps command shows the package-level or class-level dependencies of Java class files. The input class can be a path name to a .class file, a directory, a JAR file, or it can be a fully qualified class name to analyze all class files. The options determine the output. By default, the jdeps command writes the dependencies to the system output. The command can generate the dependencies in DOT language (see the -dotoutput option).
-dotoutput dir or --dot-output dirjdepscommand generates one .dot file for each analyzed archive named archive-file-name.dot that lists the dependencies, and also a summary file named summary.dot that lists the dependencies among the archive files.
-s or -summary-v or -verbosePrints all class-level dependencies. This is equivalent to
-verbose:class -filter:none
-verbose:package-verbose:class-apionly or --api-onlypublic and protected members of public classes including field type, method parameter types, returned type, and checked exception types.
-jdkinternals or --jdk-internalsFinds class-level dependences in the JDK internal APIs. By default, this option analyzes all classes specified in the --classpath option and input files unless you specified the -include option. You can't use this option with the -p, -e, and -s options.
Warning: The JDK internal APIs are inaccessible.
-cp path, -classpath path, or --class-path path--module-path module-path--upgrade-module-path module-path--system java-home--add-modules module-name[, module-name...]--multi-release version-q or -quiet-generate-module-info output.
-version or --version-m module-name or --module module-name--generate-module-info dirmodule-info.java under the specified directory. The specified JAR files will be analyzed. This option cannot be used with --dot-output or --class-path options. Use the --generate-open-module option for open modules.
--generate-open-module dirmodule-info.java for the specified JAR files under the specified directory as open modules. This option cannot be used with the --dot-output or --class-path options.
--check module-name [, module-name...]--list-deps--no-recursive option for non-transitive dependency analysis.
--list-reduced-deps--list-deps without listing the implied reads edges from the module graph. If module M1 reads M2, and M2 requires transitive on M3, then M1 reading M3 is implied and is not shown in the graph.
--print-module-deps--list-reduced-deps with printing a comma-separated list of module dependences. The output can be used by jlink --add-modules to create a custom image that contains those modules and their transitive dependences.
--ignore-missing-deps-p pkg_name, -package pkg_name, or --package pkg_name-p and -e options are mutually exclusive.
-e regex, -regex regex, or --regex regex-p and -e options are mutually exclusive.
--require module-name--package, --regex, and --require options are mutually exclusive.
-f regex or -filter regex-filter:package-filter:archive-filter:module-filter:none-filter:package and -filter:archive filtering. Filtering specified via the -filter option still applies.
--missing-deps-p, -e and -s options.
-include regex-p and -e, which apply the pattern to the dependencies.
-P or -profile-R or -recursive-R option implies -filter:none. If -p, -e, or -f options are specified, only the matching dependences are analyzed.
--no-recursive-I or -inverse--require, --package, or --regex options.
--compile-time-R option. Analyzes the dependences per other specified options. If a dependency is found from a directory, a JAR file or a module, all classes in that containing archive are analyzed.
The following example demonstrates analyzing the dependencies of the Notepad.jar file.
Oracle Solaris, Linux, and OS X:
$ jdeps demo/jfc/Notepad/Notepad.jar
Notepad.jar -> java.base
Notepad.jar -> java.desktop
Notepad.jar -> java.logging
<unnamed> (Notepad.jar)
-> java.awt
-> java.awt.event
-> java.beans
-> java.io
-> java.lang
-> java.net
-> java.util
-> java.util.logging
-> javax.swing
-> javax.swing.border
-> javax.swing.event
-> javax.swing.text
-> javax.swing.tree
-> javax.swing.undo
Windows:
C:\Java\jdk1.9.0>jdeps demo\jfc\Notepad\Notepad.jar
Notepad.jar -> java.base
Notepad.jar -> java.desktop
Notepad.jar -> java.logging
<unnamed> (Notepad.jar)
-> java.awt
-> java.awt.event
-> java.beans
-> java.io
-> java.lang
-> java.net
-> java.util
-> java.util.logging
-> javax.swing
-> javax.swing.border
-> javax.swing.event
-> javax.swing.text
-> javax.swing.tree
-> javax.swing.undo
$ jdeps --inverse --require java.xml.bind
Inverse transitive dependences on [java.xml.bind]
java.xml.bind <- java.se.ee
java.xml.bind <- jdk.xml.ws
java.xml.bind <- java.xml.ws <- java.se.ee
java.xml.bind <- java.xml.ws <- jdk.xml.ws
java.xml.bind <- jdk.xml.bind <- jdk.xml.ws