Courseiva
Java Platform Overview and PackagingmediumMultiple ChoiceObjective-mapped

1Z0-829 Java Platform Overview and Packaging Practice Question

A company has a legacy application consisting of multiple JAR files that run on Java 11. They plan to migrate to Java 17 and modularize the application using JPMS. However, some third-party libraries do not provide module-info.class files. What is the best approach to ensure the application can be modularized while maintaining compatibility with these libraries?

⚠ Common exam trap

A common mix-up: candidates assume placing all JARs on the classpath (Option B) is the simplest solution, but they overlook that the classpath creates the unnamed module, which cannot be reliably required by named modules and breaks the encapsulation benefits of JPMS, making the application non-modular.

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

Create a module-info.java for the application that requires all third-party libraries as automatic modules.

When third-party libraries lack module-info.class files, they cannot be placed on the module path as named modules. By creating a module-info.java for the application that requires these libraries as automatic modules, the application becomes a named module that can depend on the JARs, which are automatically treated as automatic modules when placed on the module path. This allows the application to be fully modularized while maintaining compatibility with non-modular libraries, as automatic modules export all their packages and read all other modules by default.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Create a module-info.java for the application that requires all third-party libraries as automatic modules.

    Why this is correct

    Automatic modules allow backward compatibility; the application can declare requires on the library names derived from JAR names.

  • Place all third-party JARs on the classpath and the application JARs on the module path.

    Why it's wrong here

    Mixing classpath and module path can cause access issues and is not a recommended migration strategy.

  • Place all JARs on the module path and use the --add-reads and --add-exports flags to resolve dependencies.

    Why it's wrong here

    This approach is cumbersome and only suitable for temporary workarounds, not for a clean migration.

  • Use the jlink tool to create a custom runtime image that includes all needed modules.

    Why it's wrong here

    jlink creates a runtime image but does not help with modularizing the source code or libraries.

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 →

How Courseiva writes practice questions · Editorial policy

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.