jdeps Kommandozeilentool in Java 8

Das JDK bringt mit jdeps ein kleines statisches Analysewerkzeug mit, welches die statischen Abhängigkeiten eines Java-Programms aufzeigt. Dabei listet es alle referenzierten Pakete auf und optional noch die Profile.

 

$ jdeps

Usage: jdeps <options> <classes…>

where <classes> can be a pathname to a .class file, a directory, a JAR file,

or a fully-qualified class name. Possible options include:

-dotoutput <dir> Destination directory for DOT file output

-s -summary Print dependency summary only

-v -verbose Print all class level dependencies

-verbose:package Print package-level dependencies excluding

dependencies within the same archive

-verbose:class Print class-level dependencies excluding

dependencies within the same archive

-cp <path> -classpath <path> Specify where to find class files

-p <pkgname> -package <pkgname> Finds dependences in the given package

(may be given multiple times)

-e <regex> -regex <regex> Finds dependences in packages matching pattern

(-p and -e are exclusive)

-include <regex> Restrict analysis to classes matching pattern

This option filters the list of classes to

be analyzed. It can be used together with

-p and -e which apply pattern to the dependences

-P -profile Show profile or the file containing a package

-apionly Restrict analysis to APIs i.e. dependences

from the signature of public and protected

members of public classes including field

type, method parameter types, returned type,

checked exception types etc

-R -recursive Recursively traverse all dependencies

-jdkinternals Finds class-level dependences on JDK internal APIs.

By default, it analyzes all classes on -classpath

and input files unless -include option is specified.

This option cannot be used with -p, -e and -s options.

WARNING: JDK internal APIs may not be accessible in

the next release.

-version Version information

 

Ein Beispiel:

 

$ jdeps "c:\Program Files\Java\jdk1.8.0\lib\ant-javafx.jar"

c:\Program Files\Java\jdk1.8.0\lib\ant-javafx.jar -> c:\Program Files\Java\jdk1.8.0\jre\lib\rt.jar

c:\Program Files\Java\jdk1.8.0\lib\ant-javafx.jar -> not found

com.javafx.main (ant-javafx.jar)

-> java.applet

-> java.awt

-> java.awt.event

-> java.io

-> java.lang

-> java.lang.reflect

-> java.net

-> java.security

-> java.util

-> java.util.jar

-> javax.swing

-> sun.misc JDK internal API (rt.jar)

com.sun.javafx.tools.ant (ant-javafx.jar)

-> java.io

-> java.lang

-> java.security.cert

-> java.util

-> java.util.jar

-> java.util.zip

-> org.apache.tools.ant not found

-> org.apache.tools.ant.taskdefs not found

-> org.apache.tools.ant.types not found

-> org.apache.tools.ant.types.resources not found

-> sun.misc JDK internal API (rt.jar)

com.sun.javafx.tools.packager (ant-javafx.jar)

-> java.io

-> java.lang

-> java.lang.reflect

-> java.math

-> java.net

-> java.nio.file

-> java.security

-> java.security.cert

-> java.text

-> java.util

-> java.util.jar

-> java.util.regex

-> java.util.zip

-> sun.misc JDK internal API (rt.jar)

-> sun.security.pkcs JDK internal API (rt.jar)

-> sun.security.timestamp JDK internal API (rt.jar)

-> sun.security.util JDK internal API (rt.jar)

-> sun.security.x509 JDK internal API (rt.jar)

com.sun.javafx.tools.packager.bundlers (ant-javafx.jar)

-> java.io

Ähnliche Beiträge

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert