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

1Z0-829 Java Platform Overview and Packaging Practice Question

A developer has written a Java class that uses external libraries packaged as JAR files. The application runs correctly when launched from an IDE but fails with a ClassNotFoundException when run from the command line using `java -cp`. What is the most likely cause?

⚠ Common exam trap

It's easy for candidates to confuse the classpath with the module path, or assume that `java -jar` automatically resolves all dependencies, when in fact it only reads the `Class-Path` manifest entry and does not combine with `-cp` unless explicitly set.

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 JAR files are not listed in the classpath argument.

When running a Java application from the command line with `java -cp`, the classpath must explicitly include all JAR files and directories containing the required classes. If the external library JARs are not listed in the `-cp` argument, the class loader cannot find them, resulting in a `ClassNotFoundException`. IDEs typically manage the classpath automatically, which is why the application works there but fails from the command line.

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 JAR files are not listed in the classpath argument.

    Why this is correct

    The classpath must explicitly list all required JAR files.

  • The classpath is missing the directory containing the class files.

    Why it's wrong here

    The class files directory is usually included, but the issue is missing JARs.

  • The JAR files are not in the module path.

    Why it's wrong here

    Module path is for modular JARs; non-modular JARs go on classpath.

  • The Java command should use java -jar instead.

    Why it's wrong here

    java -jar is only for executable JARs with a manifest; doesn't fix ClassNotFoundException.

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.