Courseiva
Java Platform Overview and PackagingeasyMultiple ChoiceObjective-mapped

1Z0-829 Java Platform Overview and Packaging Practice Question

Exhibit

Error: Could not find or load main class com.example.Main

Refer to the exhibit. The module path is correctly set to include the JAR containing the module. What is the most likely issue?

⚠ Common exam trap

Oracle often tests the distinction between module-path requirements for `java -jar` versus `java --module`, where candidates mistakenly think the main class must be exported or that a missing `module-info.class` is the issue, but the real trap is the missing main-class declaration in either the module descriptor or manifest.

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 Main class is not specified as the main class in the module descriptor or manifest.

When launching a modular JAR with `java -jar`, the JVM requires the main class to be explicitly declared either in the module descriptor (`module-info.java` with a `main-class` directive) or in the JAR's `MANIFEST.MF` (`Main-Class` attribute). Without this declaration, the JVM cannot determine the entry point, resulting in a 'Main class not found' error. Option A correctly identifies this missing declaration as the most likely issue.

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 Main class is not specified as the main class in the module descriptor or manifest.

    Why this is correct

    The JVM needs the main class specified via --main-class or manifest.

  • The JAR does not have a module-info.class.

    Why it's wrong here

    A module-info.class is not required; the JAR could be an automatic module.

  • The module requires a module that is not on the module path.

    Why it's wrong here

    That would cause a different error like 'module not found'.

  • The Main class is not in an exported package.

    Why it's wrong here

    The main class can be in a non-exported package; the JVM can still launch it.

About these practice questions

One of 513 original 1Z0-829 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. 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.