Modules   «Prev  Next»
Lesson 12 Module Graphs with jdeps
Objective Interpret Java module dependencies and verify them with jdeps.

Reading Java Module Graphs (One Diagram, Complete Story)

To minimize page weight and keep the lesson focused, we use a single comprehensive diagram that summarizes all read edges discovered by jdeps. The narrative below walks from first principles to the full graph so the image functions as the final “answer key,” not a spoiler.

1) What the arrows mean

In the Java Platform Module System (JPMS), a read edge indicates that one module reads (depends on) another. Every module implicitly reads java.base. Qualified exports and requires transitive shape which modules must be read directly and which dependencies are inherited.

2) Verify dependencies with jdeps

Start with a summary scan, then drill down if needed:


# Summary: module-to-module edges only
jdeps -summary org.module.global org.module.util org.module.base org.module.concrete

# Verbose: down to the class level (useful for surprises)
jdeps -verbose org.module.global


Inspect a specific module’s directives:


# Shows requires / exports / transitive / qualified-exports
java --module-path . --describe-module org.module.util

3) Interpreting the complete graph

Complete module graph: org.module.concrete, org.module.base, org.module.global, org.module.util → java.base with cross-module read edges
Full dependency picture derived from jdeps -summary across all four modules.

Reading the diagram from top to bottom:


If org.module.util declares requires transitive org.module.global, then any module that reads org.module.util will also read org.module.global implicitly. That is why org.module.base can acquire a read edge to org.module.global even without a direct requires in its descriptor.

4) Common exam traps and quick checks

  1. Implicit java.base: Every proper graph shows each module reading java.base.
  2. Modules, not packages: If a node is a package name, it’s not a valid JPMS graph.
  3. Qualified exports: Limit who can read a package; they do not remove the read edge.
  4. Transitive requires: Reduces explicit requires statements in dependents but still results in a read edge when summarized by jdeps.

5) Reproduce the diagram with one command


jdeps -summary org.module.global org.module.util org.module.base org.module.concrete

Use the summary to sanity-check the final image: count the arrows (read edges) and confirm they match the summary lines. If they don’t, your diagram, or your assumptions are off.