Study 1Z0-831 Java 25 JPMS, Packaging, and Launch Model: key concepts, common traps, and exam decision cues.
This page needs exact reading, not fuzzy memory. For 1Z0-831, the stem is usually testing one of four things:
One more framing point matters now: Java SE 26 is the current platform release, but this exam lane is still about Java 25 behavior. Keep stable JPMS rules separate from Java 25 preview features.
| If the stem is really about… | First question to ask | Main syntax or concept |
|---|---|---|
| module dependency | Can module A read module B? | requires |
| package exposure | Even if A reads B, is the package exported? | exports |
| service discovery | Is the code using interface/provider lookup? | uses and provides ... with ... |
| plain JAR on module path | Is this a named module or just compatibility behavior? | automatic module reasoning |
| compact source launch | Is this preview launch behavior, not normal class packaging? | compact source files and instance main |
| bulk import of exported packages | Is the code using a preview import feature? | module import declarations |
requires is about readability. exports is about exposure. The exam often wins by separating those two ideas before you inspect anything else.
1// module com.example.app
2module com.example.app {
3 requires com.example.lib;
4}
5
6// module com.example.lib
7module com.example.lib {
8 exports com.example.lib.api;
9}
If com.example.app needs com.example.lib.api.Util, then both of these must be true:
com.example.app reads com.example.libcom.example.lib exports com.example.lib.apiIf either piece is missing, access fails for a different reason.
| Situation | Likely problem |
|---|---|
| module name not readable | missing or wrong requires |
| package exists but is not accessible | package not exported |
| type is loaded dynamically through contract/provider wording | service binding question |
plain JAR on module path with no module-info.java |
automatic module behavior |
Service questions usually test runtime composition. Do not reduce them to inheritance or imports.
1// consumer module
2module com.example.app {
3 requires com.example.spi;
4 uses com.example.spi.Formatter;
5}
6
7// provider module
8module com.example.provider {
9 requires com.example.spi;
10 provides com.example.spi.Formatter
11 with com.example.provider.JsonFormatter;
12}
Strong reading:
uses belongs on the consuming sideprovides ... with ... belongs on the provider sideCommon exam mistake: choosing exports when the real question is provider discovery.
If the stem puts an ordinary JAR on the module path, you are often in automatic-module territory rather than fully designed JPMS territory.
Treat automatic modules as compatibility bridges:
module-info.javaThe exam usually is not asking you to recite every automatic-module detail. It is usually asking whether you noticed that this is compatibility behavior, not a hand-designed named module.
This is where stale Java 9-era thinking causes wrong answers. JPMS itself is old enough to be stable, but some launch-related language around this chapter is still preview in Java 25.
Java 25 still treats module import declarations as a preview language feature.
Conceptually, they let you import packages exported by a module with one declaration instead of many type imports.
1import module java.base;
2
3public class Demo {
4 String value = java.util.Objects.requireNonNull("ok");
5}
Exam rule:
mainJava 25 also keeps compact source files and instance main methods in preview.
1void main() {
2 System.out.println("Hello");
3}
That is not the same lane as normal class packaging or modular application assembly. If the stem shows a small source-launch example, do not drift into JPMS reasoning unless the question explicitly joins the two.
Preview compile/run mindset:
1javac --release 25 --enable-preview Demo.java
2java --enable-preview Demo
For source-file launch:
1java --enable-preview Demo.java
You do not need to memorize every launcher nuance. You do need to notice that preview status changes the command-line assumptions.
uses / provides.main, or module import declarations, mark preview status immediately.| Trap | Better rule |
|---|---|
treating requires like exposure |
requires is readability; exports is package visibility |
| assuming service lookup is just inheritance | service binding is runtime composition |
| treating automatic modules like authored named modules | compatibility behavior is the point |
| forgetting preview flags for preview syntax | preview status changes compile and launch assumptions |
| dragging JPMS into every launch question | compact source launch is a separate lane unless the stem connects them |
uses and provides are service words, not general module words.