Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

JDeps: Simple Dependency Analysis

DZone's Guide to

JDeps: Simple Dependency Analysis

Learn about a nifty new utility that creates simple dependency graphs of Java CLASS files.

Free Resource

Are you joining the containers revolution? Start leveraging container management using Platform9's ultimate guide to Kubernetes deployment.

In Java 8 we have a new command line tool called jdeps to know the Java dependencies. It is a nice tool to do static analysis and find out the .class/jar dependencies.

For example, I have a class and wanted to know the dependencies summary as DOT (graph description language) format I can get it by issuing the below jdeps command.

D:\>jdeps -dotoutput .  -cp jsoup-1.7.2.jar D:\classes\org\smarttechies\harvester\ProductInfoHarvester.class

Here -dotoutput <dir> option generates the DOT file for given class/jar archive and a summary DOT file under the given directory.

From the above example, jdeps generates package level dependency. The DOT visualization is given below.

jdeps package level dependency

If we want the verbose class level dependency, we can generate by passing -v option to the jdpes.

D:\>jdeps -dotoutput . -v -cp jsoup-1.7.2.jar D:\bin\org\smarttechies\harvester\ProductInfoHarvester.class

From the above example, jdeps generates classlevel dependency. The DOT visualization is given below.

jdeps class level dependency

If you want to know more options get it from help jdeps -help

Using Containers? Read our Kubernetes Comparison eBook to learn the positives and negatives of Kubernetes, Mesos, Docker Swarm and EC2 Container Services.

Topics:
dependency analysis

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}