Skip to content
geeksforgeeks
  • Tutorials
    • Python
    • Java
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
    • Practice Coding Problems
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • DSA Tutorial
  • Data Structures
  • Algorithms
  • Array
  • Strings
  • Linked List
  • Stack
  • Queue
  • Tree
  • Graph
  • Searching
  • Sorting
  • Recursion
  • Dynamic Programming
  • Binary Tree
  • Binary Search Tree
  • Heap
  • Hashing
  • Divide & Conquer
  • Mathematical
  • Geometric
  • Bitwise
  • Greedy
  • Backtracking
  • Branch and Bound
  • Matrix
  • Pattern Searching
  • Randomized
Open In App
Next Article:
Java class dependency analyzer in Java 8 with Examples
Next article icon

Java class dependency analyzer in Java 8 with Examples

Last Updated : 29 Jan, 2020
Comments
Improve
Suggest changes
Like Article
Like
Report

Java class dependency analyzer: jdeps is a new command-line tool introduced in JDK 8 to understand the static dependencies and libraries of application i.e. jdeps command shows the package-level or class-level dependencies of Java class files. The input for jdeps can be a .class file pathname, a JAR file or it can be a fully qualified class name to analyze all class files. Whenever we provide any input to jdeps command line tool then it generates the dependencies to the system console. jdeps introduced with various options which affect the output. As per option, jdeps command-line tool generates the output.

Example: Java
// Simple Java program to see the jdeps // generated output with various options  import java.util.List; import java.util.ArrayList;  class Geeks {     public static void main(String args[])     {          List<String> list1 = new ArrayList<>();         List<String> list2 = new ArrayList<>();         List<String> list3 = new ArrayList<>();          list1.add("Geeks");         list2.add("for");         list3.add("geeks");          System.out.println(list1);         System.out.println(list2);         System.out.println(list3);     } } 
Note: We have to compile above Geeks.java file and compiler will generate Geeks.class file and We have to use this file as an input for jdeps. Here I am running with Java 9 and we will see the output of jdeps with different options for this Geeks.class file as per Java 9. Output:
jdeps Geeks.class
Various options available for jdeps:
  • -dotoutput directoryPath: If we will use this option, then jdeps will generate one dot file into the directory per each analyzed archive named .dot listing the dependencies. It will also generate a summary file named summary.dot specifying the dependencies among the archives. Output:
    jdeps -dotoutput C:\Users\DubeyBis\Desktop\jdeps Geeks.class
    It will generate two files inside C:\Users\DubeyBis\Desktop\jdeps folder with the name Geeks.class.dot and summary.dot and the content of these files are below: Geeks.class.dot
      digraph "Geeks.class" {      // Path: Geeks.class     ""                  -> "java.io (java.base)";     ""                  -> "java.lang (java.base)";     ""                  -> "java.lang.invoke (java.base)";     ""                  -> "java.util (java.base)";  }  
    summary.dot
      digraph "summary" {    "Geeks.class"        -> "rt.jar";  }  
  • -summary: It will print only the summary. Instead of -summary, we can use -s also. Output:
    jdeps -summary Geeks.class
  • -verbose: It will print all class-level dependencies. Instead of -verbose, we can use -v also. Output:
    jdeps -verbose Geeks.class
  • -verbose:package: Prints package-level dependencies excluding dependencies within the same archive.
  • -verbose:class: Prints class-level dependencies excluding dependencies within the same archive. Output:
    jdeps -verbose:class Geeks.class

Next Article
Java class dependency analyzer in Java 8 with Examples

B

bishaldubey
Improve
Article Tags :
  • Java
  • Technical Scripter
  • DSA
  • Technical Scripter 2019
  • Java 8
  • Java-Classes
Practice Tags :
  • Java

Similar Reads

    Java - Divide the Classes into Packages with Examples
    Let us first know what is a class and package in Java. Class in java is a model for creating objects. It means that the properties and actions of the objects are written in class. Properties are represented by variables and actions of the objects are represented by methods. So, a class contains vari
    6 min read
    javap tool in Java with Examples
    javap tool The javap tool is used to get the information of any class or interface. The javap command (also known as the Java Disassembler) disassembles one or more class files. Its output depends on the options used (“-c” or “-verbose” for byte code and byte code along with innards info, respective
    2 min read
    Java Deprecated API Scanner tool (jdepscan) in Java 9 with Examples
    Java Deprecated API Scanner tool: Java Deprecated API Scanner tool i.e. jdeprscan is a static analyzing command-line tool which is introduced in JDK 9 for find out the uses of deprecated API in the given input. Here the input can be .class file name, directory or JAR file. Whenever we provide any in
    2 min read
    Dependency Injection with Dagger 2 in Android
    If there are two classes, class A and class B and class A depends on class B then class B is called dependent for class A.So, Every time we want to access class B in class A we need to create an instance of class B in Class A or use static factory methods to access class A. But this will make our co
    7 min read
    Java.net.JarURLConnection class in Java
    Prerequisite - JAR files in Java What is a Jar file? JavaArchive(JAR) bundles all the classes in one package. Since the archive is compressed and can be downloaded in a single HTTP connection, it is often faster to download the archive than to download individual classes. Although jar bundles all th
    4 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences