DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Related

  • Jakarta WebSocket Essentials: A Guide to Full-Duplex Communication in Java
  • Java Is Greener on Arm
  • Mastering Date/Time APIs: Challenges With Java's Calendar and JDK Date/Time APIs
  • Java 23: What Developers Need to Know

Trending

  • When Incentives Sabotage Product Strategy
  • Building Smarter Chatbots: Using AI to Generate Reflective and Personalized Responses
  • gRPC and Its Role in Microservices Communication
  • How You Clear Your HTML5 Canvas Matters
  1. DZone
  2. Coding
  3. Java
  4. jdeps: JDK 8 Command-line Static Dependency Checker

jdeps: JDK 8 Command-line Static Dependency Checker

Here's a great JDK 8 command-line static dependency checker.

By 
Dustin Marx user avatar
Dustin Marx
·
Mar. 27, 14 · Tutorial
Likes (1)
Comment
Save
Tweet
Share
23.8K Views

Join the DZone community and get the full member experience.

Join For Free

I'm a big fan of the command-line tools delivered with the Sun/Oracle HotSpot JDK. I have blogged about some of my favorites including jcmd, jps, jstack, javap, javac (-Xlint and -Xprint), jinfo, and xjc. In this post, I look briefly at a new command-line tool introduced with JDK 8: jdeps.

Although there is understandable and significant disappointment that we did not get modularity built into the Java platform with the punting of Project Jigsaw to a future release of Java, we can still gain benefits in JDK 8 from some work that went into getting the platform ready for Project Jigsaw. The new jdeps command came from work on Java modularity and is delivered with JDK 8.

jdeps is a "Java [static] class dependency analyzer" that is useful for quickly identifying "static dependencies of [developers'] applications and libraries." The level of detail shown is configurable and some ways of configuring this command's output are shown next.

The following screen snapshot demonstrates basic usage of the jdeps command against a Guava 16 JAR. Note that the basic use indicates dependencies at the package level (which packages in the JAR depend on which other packages).

Much (and I emphasize the "much") greater detail is gained by using jdeps -v (verbose) because this reports class-level dependencies rather than only package-level dependencies. The beginning of such output is shown next.

The class-level output becomes very verbose quickly and so it will often need to be redirected to a file or one can use jdeps's -dotoutput argument to write the output into files in the directory specified with the -dotoutput argument. The latter is demonstrated in the next screen snapshot.

As the screen snapshot above demonstrates, executing jdeps with the -dotoutput argument writes *.dot files to the specified directory. One of the files has the same name as the JAR whose dependencies are being analyzed (but with .dot extension rather than .jar extension) and the other file is a summary of static dependencies (much shorter than the verbose file in the same directory). These .dot files are text files and can be viewed with any text editor or text display command. As a side note, machines running Windows may "recognize" these files as Word template files based on their .dot extension (see next screen snapshot), but these are simple text files.

Conclusion

There are a few more useful options available for use with jdeps that are not covered in this post, but these can be seen by running jdeps -help or by accessing the tool's Tech Notes. The jdeps command-line tool is easy to use and quickly identifies static dependencies on a provided JAR and its package or class contents.

Java (programming language) Java Development Kit Dependency

Published at DZone with permission of Dustin Marx, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Jakarta WebSocket Essentials: A Guide to Full-Duplex Communication in Java
  • Java Is Greener on Arm
  • Mastering Date/Time APIs: Challenges With Java's Calendar and JDK Date/Time APIs
  • Java 23: What Developers Need to Know

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • [email protected]

Let's be friends: