t
Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
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.

Arch: generic
Software: JDK 8
Date: 21 November 2013
SectDesc: Basic Tools
Title: jdeps.1

jdeps 1 "21 November 2013" "JDK 8" "Basic Tools"
-----------------------------------------------------------------
* Define some portability stuff
-----------------------------------------------------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
http://bugs.debian.org/507673
http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-----------------------------------------------------------------
* set default formatting
-----------------------------------------------------------------
disable hyphenation
disable justification (adjust text to left margin only)
-----------------------------------------------------------------
* MAIN CONTENT STARTS HERE *
-----------------------------------------------------------------
NAME
jdeps - Java class dependency analyzer.
SYNOPSIS
 

jdeps [options] classes ...

options Command-line options. See Options.

classes 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.

DESCRIPTION
The \f3jdeps 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 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 outputs the dependencies to the system output. It can generate the dependencies in DOT language (see the \f3-dotoutput option).
OPTIONS

-dotoutput <dir>

Destination directory for DOT file output. If specified, \f3jdeps will generate one dot file per each analyzed archive named <archive-file-name>.dot listing the dependencies, and also a summary file named summary.dot listing the dependencies among the archives.

-s, -summary

Prints dependency summary only.

-v, -verbose

Prints all class-level dependencies.

-verbose:package

Prints package-level dependencies excluding dependencies within the same archive.

-verbose:class

Prints class-level dependencies excluding dependencies within the same archive.

-cp <path>, -classpath <path>

Specifies where to find class files. See also Setting the Class Path.

-p <pkg name>, -package <pkg name>

Finds dependencies in the specified package. You can specify this option multiple times for different packages. The \f3-p and \f3-e options are mutually exclusive.

-e <regex>, -regex <regex>

Finds dependencies in packages matching the specified regular expression pattern. The \f3-p and \f3-e options are mutually exclusive.

-include <regex>

Restricts analysis to classes matching pattern. This option filters the list of classes to be analyzed. It can be used together with \f3-p and \f3-e which apply pattern to the dependencies.

-jdkinternals

Finds class-level dependences in JDK internal APIs. By default, it analyzes all classes specified in the \f3-classpath option and in input files unless you specified the \f3-include option. You cannot use this option with the \f3-p, \f3-e, and \f3-s options. Warning: JDK internal APIs may not be accessible in upcoming releases.

-P, -profile

Shows profile or the file containing a package.

-apionly

Restricts analysis to APIs, for example, dependences from the signature of \f3public and \f3protected members of public classes including field type, method parameter types, returned type, and checked exception types.

-R, -recursive

Recursively traverses all dependencies.

-version

Prints version information.

-h, -?, -help

Prints help message for \f3jdeps.

EXAMPLES
Analyzing the dependencies of Notepad.jar.
 
\f3$ jdeps demo/jfc/Notepad/Notepad.jar
 
\f3
 
\f3demo/jfc/Notepad/Notepad.jar -> /usr/java/jre/lib/rt.jar
 
\f3 <unnamed> (Notepad.jar)
 
\f3 -> java.awt 
 
\f3 -> java.awt.event 
 
\f3 -> java.beans 
 
\f3 -> java.io 
 
\f3 -> java.lang 
 
\f3 -> java.net 
 
\f3 -> java.util 
 
\f3 -> java.util.logging 
 
\f3 -> javax.swing 
 
\f3 -> javax.swing.border 
 
\f3 -> javax.swing.event 
 
\f3 -> javax.swing.text 
 
\f3 -> javax.swing.tree 
 
\f3 -> javax.swing.undo 
 
\f3
Use -P or -profile option to show on which profile that Notepad depends.
 
\f3$ jdeps -profile demo/jfc/Notepad/Notepad.jar 
 
\f3demo/jfc/Notepad/Notepad.jar -> /usr/java/jre/lib/rt.jar (Full JRE)
 
\f3 <unnamed> (Notepad.jar)
 
\f3 -> java.awt Full JRE
 
\f3 -> java.awt.event Full JRE
 
\f3 -> java.beans Full JRE
 
\f3 -> java.io compact1
 
\f3 -> java.lang compact1
 
\f3 -> java.net compact1
 
\f3 -> java.util compact1
 
\f3 -> java.util.logging compact1
 
\f3 -> javax.swing Full JRE
 
\f3 -> javax.swing.border Full JRE
 
\f3 -> javax.swing.event Full JRE
 
\f3 -> javax.swing.text Full JRE
 
\f3 -> javax.swing.tree Full JRE
 
\f3 -> javax.swing.undo Full JRE
 
\f3
Analyzing the immediate dependencies of a specific class in a given classpath, for example the \f3com.sun.tools.jdeps.Main class in the tools.jar file.
 
\f3$ jdeps -cp lib/tools.jar com.sun.tools.jdeps.Main
 
\f3lib/tools.jar -> /usr/java/jre/lib/rt.jar
 
\f3 com.sun.tools.jdeps (tools.jar)
 
\f3 -> java.io 
 
\f3 -> java.lang 
 
\f3
Use the \f3-verbose:class option to find class-level dependencies or use the \f3-v or \f3-verbose option to include dependencies from the same JAR file.
 
\f3$ jdeps -verbose:class -cp lib/tools.jar com.sun.tools.jdeps.Main
 
\f3
 
\f3lib/tools.jar -> /usr/java/jre/lib/rt.jar
 
\f3 com.sun.tools.jdeps.Main (tools.jar)
 
\f3 -> java.io.PrintWriter 
 
\f3 -> java.lang.Exception 
 
\f3 -> java.lang.Object 
 
\f3 -> java.lang.String 
 
\f3 -> java.lang.System 
 
\f3
Use the \f3-R or \f3-recursive option to analyze the transitive dependencies of the \f3com.sun.tools.jdeps.Main class.
 
\f3$ jdeps -R -cp lib/tools.jar com.sun.tools.jdeps.Main
 
\f3lib/tools.jar -> /usr/java/jre/lib/rt.jar
 
\f3 com.sun.tools.classfile (tools.jar)
 
\f3 -> java.io 
 
\f3 -> java.lang 
 
\f3 -> java.lang.reflect 
 
\f3 -> java.nio.charset 
 
\f3 -> java.nio.file 
 
\f3 -> java.util 
 
\f3 -> java.util.regex 
 
\f3 com.sun.tools.jdeps (tools.jar)
 
\f3 -> java.io 
 
\f3 -> java.lang 
 
\f3 -> java.nio.file 
 
\f3 -> java.nio.file.attribute 
 
\f3 -> java.text 
 
\f3 -> java.util 
 
\f3 -> java.util.jar 
 
\f3 -> java.util.regex 
 
\f3 -> java.util.zip 
 
\f3/usr/java/jre/lib/jce.jar -> /usr/java/jre/lib/rt.jar
 
\f3 javax.crypto (jce.jar)
 
\f3 -> java.io 
 
\f3 -> java.lang 
 
\f3 -> java.lang.reflect 
 
\f3 -> java.net 
 
\f3 -> java.nio 
 
\f3 -> java.security 
 
\f3 -> java.security.cert 
 
\f3 -> java.security.spec 
 
\f3 -> java.util 
 
\f3 -> java.util.concurrent 
 
\f3 -> java.util.jar 
 
\f3 -> java.util.regex 
 
\f3 -> java.util.zip 
 
\f3 -> javax.security.auth 
 
\f3 -> sun.security.jca JDK internal API (rt.jar)
 
\f3 -> sun.security.util JDK internal API (rt.jar)
 
\f3 javax.crypto.spec (jce.jar)
 
\f3 -> java.lang 
 
\f3 -> java.security.spec 
 
\f3 -> java.util 
 
\f3/usr/java/jre/lib/rt.jar -> /usr/java/jre/lib/jce.jar
 
\f3 java.security (rt.jar)
 
\f3 -> javax.crypto
 
\f3
Generate dot files of the dependencies of Notepad demo.
 
\f3$ jdeps -dotoutput dot demo/jfc/Notepad/Notepad.jar
 
\f3
\f3jdeps will create one dot file for each given JAR file named <filename>.dot in the dot directory specified in the \f3-dotoutput option, and also a summary file named summary.dot that will list the dependencies among the JAR files
 
\f3$ cat dot/Notepad.jar.dot 
 
\f3digraph "Notepad.jar" {
 
\f3 // Path: demo/jfc/Notepad/Notepad.jar
 
\f3 "<unnamed>" -> "java.awt";
 
\f3 "<unnamed>" -> "java.awt.event";
 
\f3 "<unnamed>" -> "java.beans";
 
\f3 "<unnamed>" -> "java.io";
 
\f3 "<unnamed>" -> "java.lang";
 
\f3 "<unnamed>" -> "java.net";
 
\f3 "<unnamed>" -> "java.util";
 
\f3 "<unnamed>" -> "java.util.logging";
 
\f3 "<unnamed>" -> "javax.swing";
 
\f3 "<unnamed>" -> "javax.swing.border";
 
\f3 "<unnamed>" -> "javax.swing.event";
 
\f3 "<unnamed>" -> "javax.swing.text";
 
\f3 "<unnamed>" -> "javax.swing.tree";
 
\f3 "<unnamed>" -> "javax.swing.undo";
 
\f3}
 
\f3
 
\f3$ cat dot/summary.dot
 
\f3digraph "summary" {
 
\f3 "Notepad.jar" -> "rt.jar";
 
\f3}
 
\f3
SEE ALSO

0.2i javap(1)

'pl 8.5i 'bp