1Z0-829 Java Platform Overview and Packaging Practice Question
A team is migrating a large legacy application from Java 8 to Java 17. The application consists of multiple JAR files that are placed on the classpath. Some of these JAR files have been updated to include module-info.class files, making them named modules. After migration, the application throws `IllegalAccessError` for several deep reflection calls that used to work in Java 8. The team has added `--add-opens` JVM flags to open the required packages, but the error persists. The application also uses a third-party library that is not modularized and is placed on the classpath. The team notices that the `--add-opens` flags are being ignored for packages in the modularized JARs. What is the most likely reason?
⚠ Common exam trap
Oracle often tests the misconception that placing a modularized JAR on the classpath still makes it a named module, leading candidates to overlook the critical distinction between classpath (unnamed module) and module path (named module) in Java 9+.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
The modularized JARs are being loaded from the classpath, so they become unnamed modules, and `--add-opens` does not apply to unnamed modules.
When a JAR file containing a module-info.class is placed on the classpath instead of the module path, it is treated as an unnamed module. The `--add-opens` JVM flag only applies to named modules (those on the module path) and has no effect on unnamed modules. Since the modularized JARs are loaded from the classpath, they become unnamed modules, and the `--add-opens` flags are ignored, causing the `IllegalAccessError` to persist.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
The `--add-opens` flags are being overridden by other JVM flags.
Why it's wrong here
There is no indication of override; the flags are syntactically correct.
- ✗
The application does not have a module-info.java file for its own code.
Why it's wrong here
Even without a module-info, the application can still use classpath. The issue is not about the application's modularization.
- ✓
The modularized JARs are being loaded from the classpath, so they become unnamed modules, and `--add-opens` does not apply to unnamed modules.
Why this is correct
`--add-opens` only applies to named modules. JARs on the classpath, even if they have module-info, are treated as unnamed modules if placed on the classpath. They must be on the module path to be named modules.
- ✗
The classpath is deprecated and ignored in Java 17, so all JARs are treated as modules.
Why it's wrong here
The classpath is still supported in Java 17. JARs on the classpath without module-info become part of the unnamed module.
Go deeper
Related to this question
About these practice questions
Courseiva writes every 1Z0-829 question from scratch — 513 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This 1Z0-829 practice question is part of Courseiva's free Oracle certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the 1Z0-829 exam.