jdeps.1 16.6 KB
Newer Older
1 2
'\" t
.\" Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
R
rgallard 已提交
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
.\" DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
.\"
.\" This code is free software; you can redistribute it and/or modify it
.\" under the terms of the GNU General Public License version 2 only, as
.\" published by the Free Software Foundation.
.\"
.\" This code is distributed in the hope that it will be useful, but WITHOUT
.\" ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
.\" FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
.\" version 2 for more details (a copy is included in the LICENSE file that
.\" accompanied this code).
.\"
.\" You should have received a copy of the GNU General Public License version
.\" 2 along with this work; if not, write to the Free Software Foundation,
.\" Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
.\"
.\" Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
.\" or visit www.oracle.com if you need additional information or have any
.\" questions.
.\"
23 24 25 26 27 28 29 30
.\"     Arch: generic
.\"     Software: JDK 8
.\"     Date: 21 November 2013
.\"     SectDesc: Basic Tools
.\"     Title: jdeps.1
.\"
.if n .pl 99999
.TH jdeps 1 "21 November 2013" "JDK 8" "Basic Tools"
R
rgallard 已提交
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533

.SH NAME    
jdeps \- Java class dependency analyzer\&.
.SH SYNOPSIS    
.sp     
.nf     

\fBjdeps\fR [\fIoptions\fR] \fIclasses\fR \&.\&.\&.
.fi     
.sp     
.TP     
\fIoptions\fR
Command-line options\&. See Options\&.
.TP     
\fIclasses\fR
Name of the classes to analyze\&. You can specify a class that can be found in the class path, by its file name, a directory, or a JAR file\&.
.SH DESCRIPTION    
The \fI\fR\f3jdeps\fR command shows the package-level or class-level dependencies of Java class files\&. The input class can be a path name to a \f3\&.class\fR 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, \f3jdeps\fR outputs the dependencies to the system output\&. It can generate the dependencies in DOT language (see the \f3-dotoutput\fR option)\&.
.SH OPTIONS    
.TP
-dotoutput <\fIdir\fR>
.br
Destination directory for DOT file output\&. If specified, \f3jdeps\fR will generate one dot file per each analyzed archive named <\fIarchive-file-name\fR>\&.dot listing the dependencies, and also a summary file named summary\&.dot listing the dependencies among the archives\&.
.TP
-s, -summary
.br
Prints dependency summary only\&.
.TP
-v, -verbose
.br
Prints all class-level dependencies\&.
.TP
-verbose:package
.br
Prints package-level dependencies excluding dependencies within the same archive\&.
.TP
-verbose:class
.br
Prints class-level dependencies excluding dependencies within the same archive\&.
.TP
-cp <\fIpath\fR>, -classpath <\fIpath\fR>
.br
Specifies where to find class files\&.

See also Setting the Class Path\&.
.TP
-p <\fIpkg name\fR>, -package <\fIpkg name\fR>
.br
Finds dependencies in the specified package\&. You can specify this option multiple times for different packages\&. The \f3-p\fR and \f3-e\fR options are mutually exclusive\&.
.TP
-e <\fIregex\fR>, -regex <\fIregex\fR>
.br
Finds dependencies in packages matching the specified regular expression pattern\&. The \f3-p\fR and \f3-e\fR options are mutually exclusive\&.
.TP
-include <\fIregex\fR>
.br
Restricts analysis to classes matching pattern\&. This option filters the list of classes to be analyzed\&. It can be used together with \f3-p\fR and \f3-e\fR which apply pattern to the dependencies\&.
.TP
-jdkinternals
.br
Finds class-level dependences in JDK internal APIs\&. By default, it analyzes all classes specified in the \f3-classpath\fR option and in input files unless you specified the \f3-include\fR option\&. You cannot use this option with the \f3-p\fR, \f3-e\fR, and \f3-s\fR options\&.

\fIWarning\fR: JDK internal APIs may not be accessible in upcoming releases\&.
.TP
-P, -profile
.br
Shows profile or the file containing a package\&.
.TP
-apionly
.br
Restricts analysis to APIs, for example, dependences from the signature of \f3public\fR and \f3protected\fR members of public classes including field type, method parameter types, returned type, and checked exception types\&.
.TP
-R, -recursive
.br
Recursively traverses all dependencies\&.
.TP
-version
.br
Prints version information\&.
.TP
-h, -?, -help
.br
Prints help message for \f3jdeps\fR\&.
.SH EXAMPLES    
Analyzing the dependencies of Notepad\&.jar\&.
.sp     
.nf     
\f3$ jdeps demo/jfc/Notepad/Notepad\&.jar\fP
.fi     
.nf     
\f3\fP
.fi     
.nf     
\f3demo/jfc/Notepad/Notepad\&.jar \-> /usr/java/jre/lib/rt\&.jar\fP
.fi     
.nf     
\f3   <unnamed> (Notepad\&.jar)\fP
.fi     
.nf     
\f3      \-> java\&.awt                                           \fP
.fi     
.nf     
\f3      \-> java\&.awt\&.event                                     \fP
.fi     
.nf     
\f3      \-> java\&.beans                                         \fP
.fi     
.nf     
\f3      \-> java\&.io                                            \fP
.fi     
.nf     
\f3      \-> java\&.lang                                          \fP
.fi     
.nf     
\f3      \-> java\&.net                                           \fP
.fi     
.nf     
\f3      \-> java\&.util                                          \fP
.fi     
.nf     
\f3      \-> java\&.util\&.logging                                  \fP
.fi     
.nf     
\f3      \-> javax\&.swing                                        \fP
.fi     
.nf     
\f3      \-> javax\&.swing\&.border                                 \fP
.fi     
.nf     
\f3      \-> javax\&.swing\&.event                                  \fP
.fi     
.nf     
\f3      \-> javax\&.swing\&.text                                   \fP
.fi     
.nf     
\f3      \-> javax\&.swing\&.tree                                   \fP
.fi     
.nf     
\f3      \-> javax\&.swing\&.undo  \fP
.fi     
.nf     
\f3\fP
.fi     
.sp     
Use -P or -profile option to show on which profile that Notepad depends\&.
.sp     
.nf     
\f3$ jdeps \-profile demo/jfc/Notepad/Notepad\&.jar \fP
.fi     
.nf     
\f3demo/jfc/Notepad/Notepad\&.jar \-> /usr/java/jre/lib/rt\&.jar (Full JRE)\fP
.fi     
.nf     
\f3   <unnamed> (Notepad\&.jar)\fP
.fi     
.nf     
\f3      \-> java\&.awt                                           Full JRE\fP
.fi     
.nf     
\f3      \-> java\&.awt\&.event                                     Full JRE\fP
.fi     
.nf     
\f3      \-> java\&.beans                                         Full JRE\fP
.fi     
.nf     
\f3      \-> java\&.io                                            compact1\fP
.fi     
.nf     
\f3      \-> java\&.lang                                          compact1\fP
.fi     
.nf     
\f3      \-> java\&.net                                           compact1\fP
.fi     
.nf     
\f3      \-> java\&.util                                          compact1\fP
.fi     
.nf     
\f3      \-> java\&.util\&.logging                                  compact1\fP
.fi     
.nf     
\f3      \-> javax\&.swing                                        Full JRE\fP
.fi     
.nf     
\f3      \-> javax\&.swing\&.border                                 Full JRE\fP
.fi     
.nf     
\f3      \-> javax\&.swing\&.event                                  Full JRE\fP
.fi     
.nf     
\f3      \-> javax\&.swing\&.text                                   Full JRE\fP
.fi     
.nf     
\f3      \-> javax\&.swing\&.tree                                   Full JRE\fP
.fi     
.nf     
\f3      \-> javax\&.swing\&.undo                                   Full JRE\fP
.fi     
.nf     
\f3\fP
.fi     
.sp     
Analyzing the immediate dependencies of a specific class in a given classpath, for example the \f3com\&.sun\&.tools\&.jdeps\&.Main\fR class in the tools\&.jar file\&.
.sp     
.nf     
\f3$ jdeps \-cp lib/tools\&.jar com\&.sun\&.tools\&.jdeps\&.Main\fP
.fi     
.nf     
\f3lib/tools\&.jar \-> /usr/java/jre/lib/rt\&.jar\fP
.fi     
.nf     
\f3   com\&.sun\&.tools\&.jdeps (tools\&.jar)\fP
.fi     
.nf     
\f3      \-> java\&.io                                            \fP
.fi     
.nf     
\f3      \-> java\&.lang \fP
.fi     
.nf     
\f3\fP
.fi     
.sp     
Use the \f3-verbose:class\fR option to find class-level dependencies or use the \f3-v\fR or \f3-verbose\fR option to include dependencies from the same JAR file\&.
.sp     
.nf     
\f3$ jdeps \-verbose:class \-cp lib/tools\&.jar com\&.sun\&.tools\&.jdeps\&.Main\fP
.fi     
.nf     
\f3\fP
.fi     
.nf     
\f3lib/tools\&.jar \-> /usr/java/jre/lib/rt\&.jar\fP
.fi     
.nf     
\f3   com\&.sun\&.tools\&.jdeps\&.Main (tools\&.jar)\fP
.fi     
.nf     
\f3      \-> java\&.io\&.PrintWriter                                \fP
.fi     
.nf     
\f3      \-> java\&.lang\&.Exception                                \fP
.fi     
.nf     
\f3      \-> java\&.lang\&.Object                                   \fP
.fi     
.nf     
\f3      \-> java\&.lang\&.String                                   \fP
.fi     
.nf     
\f3      \-> java\&.lang\&.System \fP
.fi     
.nf     
\f3\fP
.fi     
.sp     
Use the \f3-R\fR or \f3-recursive\fR option to analyze the transitive dependencies of the \f3com\&.sun\&.tools\&.jdeps\&.Main\fR class\&.
.sp     
.nf     
\f3$ jdeps \-R \-cp lib/tools\&.jar com\&.sun\&.tools\&.jdeps\&.Main\fP
.fi     
.nf     
\f3lib/tools\&.jar \-> /usr/java/jre/lib/rt\&.jar\fP
.fi     
.nf     
\f3   com\&.sun\&.tools\&.classfile (tools\&.jar)\fP
.fi     
.nf     
\f3      \-> java\&.io                                            \fP
.fi     
.nf     
\f3      \-> java\&.lang                                          \fP
.fi     
.nf     
\f3      \-> java\&.lang\&.reflect                                  \fP
.fi     
.nf     
\f3      \-> java\&.nio\&.charset                                   \fP
.fi     
.nf     
\f3      \-> java\&.nio\&.file                                      \fP
.fi     
.nf     
\f3      \-> java\&.util                                          \fP
.fi     
.nf     
\f3      \-> java\&.util\&.regex                                    \fP
.fi     
.nf     
\f3   com\&.sun\&.tools\&.jdeps (tools\&.jar)\fP
.fi     
.nf     
\f3      \-> java\&.io                                            \fP
.fi     
.nf     
\f3      \-> java\&.lang                                          \fP
.fi     
.nf     
\f3      \-> java\&.nio\&.file                                      \fP
.fi     
.nf     
\f3      \-> java\&.nio\&.file\&.attribute                            \fP
.fi     
.nf     
\f3      \-> java\&.text                                          \fP
.fi     
.nf     
\f3      \-> java\&.util                                          \fP
.fi     
.nf     
\f3      \-> java\&.util\&.jar                                      \fP
.fi     
.nf     
\f3      \-> java\&.util\&.regex                                    \fP
.fi     
.nf     
\f3      \-> java\&.util\&.zip                                      \fP
.fi     
.nf     
\f3/usr/java/jre/lib/jce\&.jar \-> /usr/java/jre/lib/rt\&.jar\fP
.fi     
.nf     
\f3   javax\&.crypto (jce\&.jar)\fP
.fi     
.nf     
\f3      \-> java\&.io                                            \fP
.fi     
.nf     
\f3      \-> java\&.lang                                          \fP
.fi     
.nf     
\f3      \-> java\&.lang\&.reflect                                  \fP
.fi     
.nf     
\f3      \-> java\&.net                                           \fP
.fi     
.nf     
\f3      \-> java\&.nio                                           \fP
.fi     
.nf     
\f3      \-> java\&.security                                      \fP
.fi     
.nf     
\f3      \-> java\&.security\&.cert                                 \fP
.fi     
.nf     
\f3      \-> java\&.security\&.spec                                 \fP
.fi     
.nf     
\f3      \-> java\&.util                                          \fP
.fi     
.nf     
\f3      \-> java\&.util\&.concurrent                               \fP
.fi     
.nf     
\f3      \-> java\&.util\&.jar                                      \fP
.fi     
.nf     
\f3      \-> java\&.util\&.regex                                    \fP
.fi     
.nf     
\f3      \-> java\&.util\&.zip                                      \fP
.fi     
.nf     
\f3      \-> javax\&.security\&.auth                                \fP
.fi     
.nf     
\f3      \-> sun\&.security\&.jca                                   JDK internal API (rt\&.jar)\fP
.fi     
.nf     
\f3      \-> sun\&.security\&.util                                  JDK internal API (rt\&.jar)\fP
.fi     
.nf     
\f3   javax\&.crypto\&.spec (jce\&.jar)\fP
.fi     
.nf     
\f3      \-> java\&.lang                                          \fP
.fi     
.nf     
\f3      \-> java\&.security\&.spec                                 \fP
.fi     
.nf     
\f3      \-> java\&.util                                          \fP
.fi     
.nf     
\f3/usr/java/jre/lib/rt\&.jar \-> /usr/java/jre/lib/jce\&.jar\fP
.fi     
.nf     
\f3   java\&.security (rt\&.jar)\fP
.fi     
.nf     
\f3      \-> javax\&.crypto\fP
.fi     
.nf     
\f3\fP
.fi     
.sp     
Generate dot files of the dependencies of Notepad demo\&.
.sp     
.nf     
\f3$ jdeps \-dotoutput dot demo/jfc/Notepad/Notepad\&.jar\fP
.fi     
.nf     
\f3\fP
.fi     
.sp     
\f3jdeps\fR will create one dot file for each given JAR file named <\fIfilename\fR>\&.dot in the dot directory specified in the \f3-dotoutput\fR option, and also a summary file named summary\&.dot that will list the dependencies among the JAR files
.sp     
.nf     
\f3$ cat dot/Notepad\&.jar\&.dot \fP
.fi     
.nf     
\f3digraph "Notepad\&.jar" {\fP
.fi     
.nf     
\f3    // Path: demo/jfc/Notepad/Notepad\&.jar\fP
.fi     
.nf     
\f3   "<unnamed>"                                        \-> "java\&.awt";\fP
.fi     
.nf     
\f3   "<unnamed>"                                        \-> "java\&.awt\&.event";\fP
.fi     
.nf     
\f3   "<unnamed>"                                        \-> "java\&.beans";\fP
.fi     
.nf     
\f3   "<unnamed>"                                        \-> "java\&.io";\fP
.fi     
.nf     
\f3   "<unnamed>"                                        \-> "java\&.lang";\fP
.fi     
.nf     
\f3   "<unnamed>"                                        \-> "java\&.net";\fP
.fi     
.nf     
\f3   "<unnamed>"                                        \-> "java\&.util";\fP
.fi     
.nf     
\f3   "<unnamed>"                                        \-> "java\&.util\&.logging";\fP
.fi     
.nf     
\f3   "<unnamed>"                                        \-> "javax\&.swing";\fP
.fi     
.nf     
\f3   "<unnamed>"                                        \-> "javax\&.swing\&.border";\fP
.fi     
.nf     
\f3   "<unnamed>"                                        \-> "javax\&.swing\&.event";\fP
.fi     
.nf     
\f3   "<unnamed>"                                        \-> "javax\&.swing\&.text";\fP
.fi     
.nf     
\f3   "<unnamed>"                                        \-> "javax\&.swing\&.tree";\fP
.fi     
.nf     
\f3   "<unnamed>"                                        \-> "javax\&.swing\&.undo";\fP
.fi     
.nf     
\f3}\fP
.fi     
.nf     
\f3\fP
.fi     
.nf     
\f3$ cat dot/summary\&.dot\fP
.fi     
.nf     
\f3digraph "summary" {\fP
.fi     
.nf     
\f3   "Notepad\&.jar"                  \-> "rt\&.jar";\fP
.fi     
.nf     
\f3}\fP
.fi     
.nf     
\f3\fP
.fi     
.sp     
.SH SEE\ ALSO    
.TP 0.2i    
\(bu
javap(1)
R
rgallard 已提交
534 535 536 537
.RE
.br
'pl 8.5i
'bp