1jdeps(1)                          Basic Tools                         jdeps(1)
2
3
4

NAME

6       jdeps - Java class dependency analyzer.
7

SYNOPSIS

9       jdeps [options] classes ...
10
11
12       options
13              Command-line options. See Options.
14
15       classes
16              Name of the classes to analyze. You can specify a class that can
17              be found in the class path, by its file name, a directory, or a
18              JAR file.
19

DESCRIPTION

21       The jdeps command shows the package-level or class-level dependencies
22       of Java class files. The input class can be a path name to a .class
23       file, a directory, a JAR file, or it can be a fully qualified class
24       name to analyze all class files. The options determine the output. By
25       default, jdeps outputs the dependencies to the system output. It can
26       generate the dependencies in DOT language (see the -dotoutput option).
27

OPTIONS

29       -dotoutput <dir>
30              Destination directory for DOT file output. If specified, jdeps
31              will generate one dot file per each analyzed archive named
32              <archive-file-name>.dot listing the dependencies, and also a
33              summary file named summary.dot listing the dependencies among
34              the archives.
35
36       -s, -summary
37              Prints dependency summary only.
38
39       -v, -verbose
40              Prints all class-level dependencies.
41
42       -verbose:package
43              Prints package-level dependencies excluding dependencies within
44              the same archive.
45
46       -verbose:class
47              Prints class-level dependencies excluding dependencies within
48              the same archive.
49
50       -cp <path>, -classpath <path>
51              Specifies where to find class files.
52
53              See also Setting the Class Path.
54
55       -p <pkg name>, -package <pkg name>
56              Finds dependencies in the specified package. You can specify
57              this option multiple times for different packages. The -p and -e
58              options are mutually exclusive.
59
60       -e <regex>, -regex <regex>
61              Finds dependencies in packages matching the specified regular
62              expression pattern. The -p and -e options are mutually
63              exclusive.
64
65       -include <regex>
66              Restricts analysis to classes matching pattern. This option
67              filters the list of classes to be analyzed. It can be used
68              together with -p and -e which apply pattern to the dependencies.
69
70       -jdkinternals
71              Finds class-level dependences in JDK internal APIs. By default,
72              it analyzes all classes specified in the -classpath option and
73              in input files unless you specified the -include option. You
74              cannot use this option with the -p, -e, and -s options.
75
76              Warning: JDK internal APIs may not be accessible in upcoming
77              releases.
78
79       -P, -profile
80              Shows profile or the file containing a package.
81
82       -apionly
83              Restricts analysis to APIs, for example, dependences from the
84              signature of public and protected members of public classes
85              including field type, method parameter types, returned type, and
86              checked exception types.
87
88       -R, -recursive
89              Recursively traverses all dependencies.
90
91       -version
92              Prints version information.
93
94       -h, -?, -help
95              Prints help message for jdeps.
96

EXAMPLES

98       Analyzing the dependencies of Notepad.jar.
99
100       $ jdeps demo/jfc/Notepad/Notepad.jar
101       demo/jfc/Notepad/Notepad.jar -> /usr/java/jre/lib/rt.jar
102          <unnamed> (Notepad.jar)
103             -> java.awt
104             -> java.awt.event
105             -> java.beans
106             -> java.io
107             -> java.lang
108             -> java.net
109             -> java.util
110             -> java.util.logging
111             -> javax.swing
112             -> javax.swing.border
113             -> javax.swing.event
114             -> javax.swing.text
115             -> javax.swing.tree
116             -> javax.swing.undo
117
118       Use -P or -profile option to show on which profile that Notepad
119       depends.
120
121       $ jdeps -profile demo/jfc/Notepad/Notepad.jar
122       demo/jfc/Notepad/Notepad.jar -> /usr/java/jre/lib/rt.jar (Full JRE)
123          <unnamed> (Notepad.jar)
124             -> java.awt                                           Full JRE
125             -> java.awt.event                                     Full JRE
126             -> java.beans                                         Full JRE
127             -> java.io                                            compact1
128             -> java.lang                                          compact1
129             -> java.net                                           compact1
130             -> java.util                                          compact1
131             -> java.util.logging                                  compact1
132             -> javax.swing                                        Full JRE
133             -> javax.swing.border                                 Full JRE
134             -> javax.swing.event                                  Full JRE
135             -> javax.swing.text                                   Full JRE
136             -> javax.swing.tree                                   Full JRE
137             -> javax.swing.undo                                   Full JRE
138
139       Analyzing the immediate dependencies of a specific class in a given
140       classpath, for example the com.sun.tools.jdeps.Main class in the
141       tools.jar file.
142
143       $ jdeps -cp lib/tools.jar com.sun.tools.jdeps.Main
144       lib/tools.jar -> /usr/java/jre/lib/rt.jar
145          com.sun.tools.jdeps (tools.jar)
146             -> java.io
147             -> java.lang
148
149       Use the -verbose:class option to find class-level dependencies or use
150       the -v or -verbose option to include dependencies from the same JAR
151       file.
152
153       $ jdeps -verbose:class -cp lib/tools.jar com.sun.tools.jdeps.Main
154       lib/tools.jar -> /usr/java/jre/lib/rt.jar
155          com.sun.tools.jdeps.Main (tools.jar)
156             -> java.io.PrintWriter
157             -> java.lang.Exception
158             -> java.lang.Object
159             -> java.lang.String
160             -> java.lang.System
161
162       Use the -R or -recursive option to analyze the transitive dependencies
163       of the com.sun.tools.jdeps.Main class.
164
165       $ jdeps -R -cp lib/tools.jar com.sun.tools.jdeps.Main
166       lib/tools.jar -> /usr/java/jre/lib/rt.jar
167          com.sun.tools.classfile (tools.jar)
168             -> java.io
169             -> java.lang
170             -> java.lang.reflect
171             -> java.nio.charset
172             -> java.nio.file
173             -> java.util
174             -> java.util.regex
175          com.sun.tools.jdeps (tools.jar)
176             -> java.io
177             -> java.lang
178             -> java.nio.file
179             -> java.nio.file.attribute
180             -> java.text
181             -> java.util
182             -> java.util.jar
183             -> java.util.regex
184             -> java.util.zip
185       /usr/java/jre/lib/jce.jar -> /usr/java/jre/lib/rt.jar
186          javax.crypto (jce.jar)
187             -> java.io
188             -> java.lang
189             -> java.lang.reflect
190             -> java.net
191             -> java.nio
192             -> java.security
193             -> java.security.cert
194             -> java.security.spec
195             -> java.util
196             -> java.util.concurrent
197             -> java.util.jar
198             -> java.util.regex
199             -> java.util.zip
200             -> javax.security.auth
201             -> sun.security.jca                                   JDK internal API (rt.jar)
202             -> sun.security.util                                  JDK internal API (rt.jar)
203          javax.crypto.spec (jce.jar)
204             -> java.lang
205             -> java.security.spec
206             -> java.util
207       /usr/java/jre/lib/rt.jar -> /usr/java/jre/lib/jce.jar
208          java.security (rt.jar)
209             -> javax.crypto
210
211       Generate dot files of the dependencies of Notepad demo.
212
213       $ jdeps -dotoutput dot demo/jfc/Notepad/Notepad.jar
214
215       jdeps will create one dot file for each given JAR file named
216       <filename>.dot in the dot directory specified in the -dotoutput option,
217       and also a summary file named summary.dot that will list the
218       dependencies among the JAR files
219
220       $ cat dot/Notepad.jar.dot
221       digraph "Notepad.jar" {
222           // Path: demo/jfc/Notepad/Notepad.jar
223          "<unnamed>"                                        -> "java.awt";
224          "<unnamed>"                                        -> "java.awt.event";
225          "<unnamed>"                                        -> "java.beans";
226          "<unnamed>"                                        -> "java.io";
227          "<unnamed>"                                        -> "java.lang";
228          "<unnamed>"                                        -> "java.net";
229          "<unnamed>"                                        -> "java.util";
230          "<unnamed>"                                        -> "java.util.logging";
231          "<unnamed>"                                        -> "javax.swing";
232          "<unnamed>"                                        -> "javax.swing.border";
233          "<unnamed>"                                        -> "javax.swing.event";
234          "<unnamed>"                                        -> "javax.swing.text";
235          "<unnamed>"                                        -> "javax.swing.tree";
236          "<unnamed>"                                        -> "javax.swing.undo";
237       }
238       $ cat dot/summary.dot
239       digraph "summary" {
240          "Notepad.jar"                  -> "rt.jar";
241       }
242
243

SEE ALSO

245       ยท javap(1)
246
247
248
249JDK 8                          21 November 2013                       jdeps(1)
Impressum