skip to content

JPMS Tooling: jlink, jdeps, jmod

jlink assembles a minimal runtime image containing only the modules you need, jdeps analyzes dependencies and flags internal-API use, and jmod handles .jmod files. jlink is the practical payoff of modularization and the one interviewers mention.

part ofJavaoverview, primer and where to startread it →
on this pageshow

questions

5

What is jdeps, and what kinds of problems does it help you diagnose in a Java codebase?

level: juniorimportance: should knowfreq 45%

basics

~10 s

jdeps is a JDK command-line tool that analyzes the dependencies of compiled Java classes and JARs. It shows which packages and modules your code depends on, and can flag use of internal JDK APIs.

open as a page

What is a .jmod file and how does it differ from a regular JAR, and when do you need jmod?

level: seniorimportance: should knowfreq 40%

basics

~20 s

A .jmod file is a packaging format for a module that, unlike a JAR, can also carry native libraries, native commands, config files, and legal/header files. You create and inspect .jmod files with the jmod tool. They are used at link time (by jlink), not at application runtime.

open as a page

Walk through how jdeps, jmod, and jlink work together to ship a minimal runtime, and what breaks the chain.

level: seniorimportance: should knowfreq 38%

basics

~20 s

jdeps analyzes your code to find its dependencies and can draft a module descriptor; jmod packages a module (including native code) into a .jmod; jlink links your modules and their dependencies into a small, self-contained runtime image. The chain breaks mainly on non-modular libraries and on dependencies resolved by reflection.

open as a page

Your team is upgrading from JDK 8 to JDK 21 and worried about strongly-encapsulated internal APIs. How do you use the JPMS tooling to assess and de-risk this, and what are the tooling's limits?

level: principalimportance: should knowfreq 34%

basics

~20 s

Run jdeps --jdk-internals across all your code and dependency JARs to find usage of internal JDK APIs and their suggested replacements, then fix or replace those before upgrading. Because jdeps is static, also runtime-test, since reflective access to internals won't show up.

open as a page