The Java Platform Module System (JPMS), introduced in Java 9, organizes the JDK itself into a set of named modules. You can list all available modules with a single command and filter them to find what you need.


The Command

java --list-modules

Run this in any terminal. It lists every module bundled in your JDK installation, one per line, with its version number.

Sample output (JDK 21):

java.base@21
java.compiler@21
java.datatransfer@21
java.desktop@21
java.instrument@21
java.logging@21
java.management@21
java.net.http@21
java.prefs@21
java.rmi@21
java.scripting@21
java.se@21
java.security.jgss@21
java.security.sasl@21
java.sql@21
java.sql.rowset@21
java.xml@21
java.xml.crypto@21
jdk.accessibility@21
jdk.attach@21
jdk.compiler@21
jdk.httpserver@21
jdk.jartool@21
jdk.javadoc@21
jdk.jconsole@21
jdk.jdeps@21
jdk.jdi@21
jdk.jfr@21
jdk.jlink@21
jdk.jpackage@21
jdk.jshell@21
jdk.management@21
jdk.net@21
jdk.sctp@21
jdk.security.auth@21
jdk.security.jgss@21
jdk.zipfs@21
...

Module Naming Conventions

PrefixMeaningExamples
java.*Java SE specification modules — defined by the Java standardjava.base, java.sql, java.net.http
jdk.*JDK-specific modules — tools and implementation details, not part of the Java SE specjdk.compiler, jdk.jshell, jdk.jfr

java.* modules are portable — they're available in any conforming Java SE implementation (OpenJDK, GraalVM, Amazon Corretto, etc.). jdk.* modules may differ between vendors.


Key Platform Modules to Know

ModuleWhat It Provides
java.baseCore classes: java.lang, java.util, java.io, java.nio — always available, never needs to be declared
java.sqlJDBC API: java.sql, javax.sql
java.net.httpModern HTTP client (Java 11+): java.net.http
java.loggingJUL: java.util.logging
java.desktopAWT, Swing: java.awt, javax.swing
jdk.compilerThe javac compiler API
jdk.jshellJShell REPL API
jdk.jfrJava Flight Recorder for profiling

Filtering the Module List

The output can be long. Pipe through grep to find specific modules:

# Find all SQL-related modules
java --list-modules | grep sql

# Find all security modules
java --list-modules | grep security

# Count total modules
java --list-modules | wc -l

Describe a Single Module

To see what packages a specific module exports and what it requires:

java --describe-module java.sql

Output:

java.sql@21
exports java.sql
exports javax.sql
requires java.logging transitive
requires java.transaction.xa transitive
requires java.xml transitive
uses java.sql.Driver

This tells you which packages are publicly accessible from the module, and which other modules it depends on.


module-info.java — Declaring Your Own Module

In a modular application, each module declares its dependencies and exports in a module-info.java file at the source root:

module com.myapp.core {
    requires java.sql;          // depends on java.sql module
    requires java.logging;      // depends on java.logging module
    exports com.myapp.api;      // makes this package visible to other modules
}

Modules that aren't declared in requires are not accessible at runtime, even if their JARs are on the classpath. This enforces explicit dependency declarations and prevents accidental use of internal APIs.


Classpath vs Module Path

Most applications still use the traditional classpath rather than the module system. You don't need to use module-info.java to run Java 9+ applications — all platform modules remain accessible via the unnamed module when you launch normally with java -cp. The module system becomes relevant when you're building a modular application or creating a custom runtime image with jlink.


Summary

Run java --list-modules to see all modules in your JDK. Modules prefixed java.* are part of the Java SE specification; jdk.* modules are JDK-specific tools. Use java --describe-module <name> to inspect a module's exports and requirements. For modular applications, declare your module's dependencies in module-info.java.