JDEPS(1)
πΈ NAME πΈ
Okay bestie, welcome to the jdeps page β aka JDEPS(1) from the JDK Commands manual β and itβs literally the launchpad for the Java class dependency analyzer. Slay.
β¨ SYNOPSIS β¨
jdeps [options] path ...
optionsβ Command-line options. For detailed descriptions of the options that can be used, see:- Possible Options
- Module Dependence Analysis Options
- Options to Filter Dependences
- Options to Filter Classes to be Analyzed
pathβ A pathname to the.classfile, directory, or JAR file to analyze.
π¦ DESCRIPTION π¦
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). DOT language era, fr fr.
π POSSIBLE OPTIONS π
-?,-h,--helpβ Prints the help message. The classic βhelp me help youβ moment.-dotoutputdir,--dot-outputdir β Specifies the destination directory for DOT file output. If this option is specified, then thejdepscommand generates one.dotfile for each analyzed archive namedarchive-file-name.dotthat lists the dependencies, and also a summary file namedsummary.dotthat lists the dependencies among the archive files. Archive-by-archive tea.-s,-summaryβ Prints a dependency summary only. Short, sweet, iconic.-v,-verboseβ Prints all class-level dependencies. This is equivalent to-verbose:class -filter:none. Same energy, more output.-verbose:packageβ Prints package-level dependencies excluding, by default, dependencies within the same package.-verbose:classβ Prints class-level dependencies excluding, by default, dependencies within the same archive.-apionly,--api-onlyβ Restricts the analysis to APIs, for example, dependences from the signature of public and protected members of public classes including field type, method parameter types, returned type, and checked exception types. API-only, very demure.-jdkinternals,--jdk-internalsβ Finds class-level dependences in the JDK internal APIs. By default, this option analyzes all classes specified in the--class-pathoption and input files unless you specified the-includeoption. You canβt use this option with the-p,-e, and-soptions.
Warning: The JDK internal APIs are inaccessible. Thatβs the warning, bestie β do not ignore it.
-cppath,-classpathpath,--class-pathpath β Specifies where to find class files. Your classpath treasure map.--module-pathmodule-path β Specifies the module path.--upgrade-module-pathmodule-path β Specifies the upgrade module path.--systemjava-home β Specifies an alternate system module path.--add-modulesmodule-name[, module-name...]β Adds modules to the root set for analysis.--multi-releaseversion β Specifies the version when processing multi-release JAR files. version should be an integer>=9orbase.-q,-quietβ Doesnβt show missing dependencies from-generate-module-infooutput. Quiet mode, but make it fashion.-version,--versionβ Prints version information.
π MODULE DEPENDENCE ANALYSIS OPTIONS π
-mmodule-name,--modulemodule-name β Specifies the root module for analysis. Main character module.--generate-module-infodir β Generatesmodule-info.javaunder the specified directory. The specified JAR files will be analyzed. This option cannot be used with--dot-outputor--class-pathoptions. Use the--generate-open-moduleoption for open modules.--generate-open-moduledir β Generatesmodule-info.javafor the specified JAR files under the specified directory as open modules. This option cannot be used with the--dot-outputor--class-pathoptions.--checkmodule-name [, module-name...]β Analyzes the dependence of the specified modules. It prints the module descriptor, the resulting module dependences after analysis and the graph after transition reduction. It also identifies any unused qualified exports.--list-depsβ Lists the module dependences and also the package names of JDK internal APIs (if referenced). This option transitively analyzes libraries on class path and module path if referenced. Use--no-recursiveoption for non-transitive dependency analysis.--list-reduced-depsβ Same as--list-depswithout listing the implied reads edges from the module graph. If moduleM1readsM2, andM2requires transitive onM3, thenM1readingM3is implied and is not shown in the graph.--print-module-depsβ Same as--list-reduced-depswith printing a comma-separated list of module dependences. The output can be used byjlink --add-modulesto create a custom image that contains those modules and their transitive dependences.--ignore-missing-depsβ Ignore missing dependences. Not me pretending I didnβt see them.
π OPTIONS TO FILTER DEPENDENCES π
-ppkg_name,-packagepkg_name,--packagepkg_name β Finds dependences matching the specified package name. You can specify this option multiple times for different packages. The-pand-eoptions are mutually exclusive. Pick a lane, bestie.-eregex,-regexregex,--regexregex β Finds dependences matching the specified pattern. The-pand-eoptions are mutually exclusive.--requiremodule-name β Finds dependences matching the given module name (may be given multiple times). The--package,--regex, and--requireoptions are mutually exclusive.-fregex,-filterregex β Filters dependences matching the given pattern. If you give it multiple times, the last one will be selected.-filter:packageβ Filters dependences within the same package. This is the default.-filter:archiveβ Filters dependences within the same archive.-filter:moduleβ Filters dependences within the same module.-filter:noneβ No-filter:packageand-filter:archivefiltering. Filtering specified via the-filteroption still applies.--missing-depsβ Finds missing dependences. This option cannot be used with-p,-eand-soptions. Hard no on mixing those.
π OPTIONS TO FILTER CLASSES TO BE ANALYZED π
-includeregex β Restricts analysis to the classes matching pattern. This option filters the list of classes to be analyzed. It can be used together with-pand-e, which apply the pattern to the dependencies.-P,-profileβ Shows the profile containing a package. This option is deprecated and may be removed in a future release. Deprecated alert, bestie.-R,--recursiveβ Recursively traverses all run-time dependences. The-Roption implies-filter:none. If-p,-e, or-foptions are specified, only the matching dependences are analyzed.--no-recursiveβ Do not recursively traverse dependences.-I,--inverseβ Analyzes the dependences per other given options and then finds all artifacts that directly and indirectly depend on the matching nodes. This is equivalent to the inverse of the compile-time view analysis and the print dependency summary. This option must be used with the--require,--package, or--regexoptions.--compile-timeβ Analyzes the compile-time view of transitive dependencies, such as the compile-time view of the-Roption. 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.
π EXAMPLE OF ANALYZING DEPENDENCIES π
The following example demonstrates analyzing the dependencies of the Notepad.jar file.
Linux and macOS:
$ 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
β EXAMPLE USING THE --INVERSE OPTION β
$ 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
π Cute sign-off: this whole page is from JDK 21, dated 2023, and itβs the JDEPS(1) manual page. Periodt. π
π¦ where this page comes from
- centos-stream 10: java-21-openjdk-devel-slowdebug 1:21.0.12.1.1-2.1.el10 Β· ASL 1.1 and ASL 2.0 and BSD and BSD with advertising and GPL+ and GPLv2 and GPLv2 with exceptions and IJG and LGPLv2+ and MIT and MPLv2.0 and Public Domain and W3C and zlib and ISC and FTL and RSA
- Copyright (c) 2013, 2023, Oracle and/or its affiliates. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms