1JDEPS(1)                         JDK Commands                         JDEPS(1)
2
3
4

NAME

6       jdeps - launch the Java class dependency analyzer
7

SYNOPSIS

9       jdeps [options] path ...
10
11       options
12              Command-line  options.  For detailed descriptions of the options
13              that can be used, see
14
15Possible Options
16
17Module Dependence Analysis Options
18
19Options to Filter Dependences
20
21Options to Filter Classes to be Analyzed
22
23       path   A pathname to the .class file, directory, or JAR  file  to  ana‐
24              lyze.
25

DESCRIPTION

27       The  jdeps  command shows the package-level or class-level dependencies
28       of Java class files.  The input class can be a path name  to  a  .class
29       file,  a  directory,  a  JAR file, or it can be a fully qualified class
30       name to analyze all class files.  The options determine the output.  By
31       default,  the  jdeps command writes the dependencies to the system out‐
32       put.  The command can generate the dependencies in  DOT  language  (see
33       the -dotoutput option).
34

POSSIBLE OPTIONS

36       -? or -h or --help
37              Prints the help message.
38
39       -dotoutput dir or --dot-output dir
40              Specifies  the  destination  directory  for DOT file output.  If
41              this option is specified, then the  jdepscommand  generates  one
42              .dot  file for each analyzed archive named archive-file-name.dot
43              that lists the dependencies, and also a summary file named  sum‐
44              mary.dot that lists the dependencies among the archive files.
45
46       -s or -summary
47              Prints a dependency summary only.
48
49       -v or -verbose
50              Prints all class-level dependencies.  This is equivalent to
51
52                     -verbose:class -filter:none
53
54       -verbose:package
55              Prints  package-level dependencies excluding, by default, depen‐
56              dences within the same package.
57
58       -verbose:class
59              Prints class-level dependencies excluding, by default, dependen‐
60              cies within the same archive.
61
62       -apionly or --api-only
63              Restricts  the  analysis  to APIs, for example, dependences from
64              the signature of public and protected members of public  classes
65              including field type, method parameter types, returned type, and
66              checked exception types.
67
68       -jdkinternals or --jdk-internals
69              Finds class-level dependences in the JDK internal APIs.  By  de‐
70              fault,  this  option  analyzes  all  classes  specified  in  the
71              --classpath option and input files unless you specified the -in‐
72              clude option.  You can't use this option with the -p, -e, and -s
73              options.
74
75              Warning: The JDK internal APIs are inaccessible.
76
77       -cp path, -classpath path, or --class-path path
78              Specifies where to find class files.
79
80       --module-path module-path
81              Specifies the module path.
82
83       --upgrade-module-path module-path
84              Specifies the upgrade module path.
85
86       --system java-home
87              Specifies an alternate system module path.
88
89       --add-modules module-name[, module-name...]
90              Adds modules to the root set for analysis.
91
92       --multi-release version
93              Specifies the version when processing multi-release  JAR  files.
94              version should be an integer >=9 or base.
95
96       -q or -quiet
97              Doesn't  show  missing  dependencies  from -generate-module-info
98              output.
99
100       -version or --version
101              Prints version information.
102

MODULE DEPENDENCE ANALYSIS OPTIONS

104       -m module-name or --module module-name
105              Specifies the root module for analysis.
106
107       --generate-module-info dir
108              Generates module-info.java under the specified  directory.   The
109              specified  JAR  files  will  be analyzed.  This option cannot be
110              used with --dot-output or --class-path options.  Use the  --gen‐
111              erate-open-module option for open modules.
112
113       --generate-open-module dir
114              Generates module-info.java for the specified JAR files under the
115              specified directory as open modules.  This option cannot be used
116              with the --dot-output or --class-path options.
117
118       --check module-name [, module-name...]
119              Analyzes the dependence of the specified modules.  It prints the
120              module descriptor, the resulting module dependences after analy‐
121              sis  and  the graph after transition reduction.  It also identi‐
122              fies any unused qualified exports.
123
124       --list-deps
125              Lists the module dependences and also the package names  of  JDK
126              internal  APIs  (if  referenced).  This option transitively ana‐
127              lyzes libraries on class path and  module  path  if  referenced.
128              Use  --no-recursive  option for non-transitive dependency analy‐
129              sis.
130
131       --list-reduced-deps
132              Same as --list-deps without listing the implied reads edges from
133              the  module graph.  If module M1 reads M2, and M2 requires tran‐
134              sitive on M3, then M1 reading M3 is implied and is not shown  in
135              the graph.
136
137       --print-module-deps
138              Same as --list-reduced-deps with printing a comma-separated list
139              of  module   dependences.    The   output   can   be   used   by
140              jlink --add-modules to create a custom image that contains those
141              modules and their transitive dependences.
142
143       --ignore-missing-deps
144              Ignore missing dependences.
145

OPTIONS TO FILTER DEPENDENCES

147       -p pkg_name, -package pkg_name, or --package pkg_name
148              Finds dependences matching the specified package name.  You  can
149              specify  this option multiple times for different packages.  The
150              -p and -e options are mutually exclusive.
151
152       -e regex, -regex regex, or --regex regex
153              Finds dependences matching the specified pattern.  The -p and -e
154              options are mutually exclusive.
155
156       --require module-name
157              Finds  dependences  matching the given module name (may be given
158              multiple times).  The --package, --regex, and --require  options
159              are mutually exclusive.
160
161       -f regex or -filter regex
162              Filters  dependences matching the given pattern.  If give multi‐
163              ple times, the last one will be selected.
164
165       -filter:package
166              Filters dependences within the same package.  This  is  the  de‐
167              fault.
168
169       -filter:archive
170              Filters dependences within the same archive.
171
172       -filter:module
173              Filters dependences within the same module.
174
175       -filter:none
176              No  -filter:package  and  -filter:archive  filtering.  Filtering
177              specified via the -filter option still applies.
178
179       --missing-deps
180              Finds missing dependences.  This option cannot be used with  -p,
181              -e and -s options.
182

OPTIONS TO FILTER CLASSES TO BE ANALYZED

184       -include regex
185              Restricts analysis to the classes matching pattern.  This option
186              filters the list of classes to be analyzed.  It can be used  to‐
187              gether  with -p and -e, which apply the pattern to the dependen‐
188              cies.
189
190       -P or -profile
191              Shows the profile containing a package.
192
193       -R or --recursive
194              Recursively traverses all run-time dependences.  The  -R  option
195              implies  -filter:none.   If -p, -e, or -f options are specified,
196              only the matching dependences are analyzed.
197
198       --no-recursive
199              Do not recursively traverse dependences.
200
201       -I or --inverse
202              Analyzes the dependences per other given options and then  finds
203              all  artifacts that directly and indirectly depend on the match‐
204              ing nodes.  This is  equivalent  to  the  inverse  of  the  com‐
205              pile-time  view analysis and the print dependency summary.  This
206              option must be used with the --require,  --package,  or  --regex
207              options.
208
209       --compile-time
210              Analyzes  the compile-time view of transitive dependencies, such
211              as the compile-time view of the -R option.  Analyzes the  depen‐
212              dences  per  other  specified options.  If a dependency is found
213              from a directory, a JAR file or a module, all  classes  in  that
214              containing archive are analyzed.
215

EXAMPLE OF ANALYZING DEPENDENCIES

217       The  following  example  demonstrates analyzing the dependencies of the
218       Notepad.jar file.
219
220       Linux and OS X:
221
222              $ jdeps demo/jfc/Notepad/Notepad.jar
223              Notepad.jar -> java.base
224              Notepad.jar -> java.desktop
225              Notepad.jar -> java.logging
226                 <unnamed> (Notepad.jar)
227                    -> java.awt
228                    -> java.awt.event
229                    -> java.beans
230                    -> java.io
231                    -> java.lang
232                    -> java.net
233                    -> java.util
234                    -> java.util.logging
235                    -> javax.swing
236                    -> javax.swing.border
237                    -> javax.swing.event
238                    -> javax.swing.text
239                    -> javax.swing.tree
240                    -> javax.swing.undo
241
242       Windows:
243
244              C:\Java\jdk1.9.0>jdeps demo\jfc\Notepad\Notepad.jar
245              Notepad.jar -> java.base
246              Notepad.jar -> java.desktop
247              Notepad.jar -> java.logging
248                 <unnamed> (Notepad.jar)
249                    -> java.awt
250                    -> java.awt.event
251                    -> java.beans
252                    -> java.io
253                    -> java.lang
254                    -> java.net
255                    -> java.util
256                    -> java.util.logging
257                    -> javax.swing
258                    -> javax.swing.border
259                    -> javax.swing.event
260                    -> javax.swing.text
261                    -> javax.swing.tree
262                    -> javax.swing.undo
263

EXAMPLE USING THE --INVERSE OPTION

265               $ jdeps --inverse --require java.xml.bind
266              Inverse transitive dependences on [java.xml.bind]
267              java.xml.bind <- java.se.ee
268              java.xml.bind <- jdk.xml.ws
269              java.xml.bind <- java.xml.ws <- java.se.ee
270              java.xml.bind <- java.xml.ws <- jdk.xml.ws
271              java.xml.bind <- jdk.xml.bind <- jdk.xml.ws
272
273
274
275JDK 19                               2022                             JDEPS(1)
Impressum