0Pricing
Java Academy · Lesson

module-info.java

Declare a module.

The Module System

The Java Platform Module System (JPMS), introduced in Java 9, lets you group packages into named modules with explicit dependencies and boundaries.

The declaration lives in a special file: module-info.java.

Why Modules

Before modules, the classpath was a flat, unstructured bag of JARs. Anyone could access any public class, and missing dependencies surfaced only at runtime.

Modules add strong encapsulation and reliable configuration verified at compile and launch time.

All lessons in this course

  1. module-info.java
  2. requires and exports
  3. Services with provides/uses
  4. Migrating to Modules
← Back to Java Academy