Courseiva
Question 275 of 513
Java Platform Overview and PackagingeasyMultiple ChoiceObjective-mapped

1Z0-829 Java Platform Overview and Packaging Practice Question

A developer wants to create an executable JAR file. Which jar command option is used to specify the main class?

⚠ Common exam trap

It's easy for candidates to confuse `--main-class` with `--class-path` or think `--create` alone makes the JAR executable, but `--create` only builds the archive without setting an entry point.

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

--main-class

The `--main-class` option (or `-e` in older syntax) specifies the fully qualified name of the class containing the `public static void main(String[])` method when creating an executable JAR with the `jar` command. This entry is stored in the JAR's `META-INF/MANIFEST.MF` file under the `Main-Class` header, which the Java launcher reads to determine the entry point.

Answer analysis

Option-by-option breakdown

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

  • --main-class

    Why this is correct

    --main-class specifies the main class for an executable JAR.

  • --class-path

    Why it's wrong here

    --class-path sets the class path for the JAR, not the main class.

  • --module-version

    Why it's wrong here

    --module-version sets the module version, not the main class.

  • --create

    Why it's wrong here

    --create is used to create a new JAR file, not set the main class.

About these practice questions

Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Last reviewed: Jun 25, 2026

Question Discussion

Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.

Loading comments…

Sign in to join the discussion.

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.