- A
Use the `--add-modules` option to include `javafx.controls` and other required modules in the command.
Why wrong: The modules are already added; the issue is about launching the main class.
- B
Use the `--launcher` option in jlink to create a launcher script that automatically runs the main class with the correct module.
The `--launcher` option generates a platform-specific script (e.g., myapp.sh or myapp.bat) that invokes the JVM with the correct module and main class, avoiding the need to specify them manually.
- C
Add the `--bind-services` option to jlink to automatically include service provider modules.
Why wrong: This does not affect the main class launcher; it is for service binding.
- D
Ensure that the `com.myapp` module reads all required modules by adding `requires` directives in module-info.java.
Why wrong: If required modules were missing, the error would be different (e.g., module not found) and the application would have failed on the development machine as well.
Quick Answer
The correct answer is to use the `--launcher` option in jlink to create a launcher script that automatically runs the main class with the correct module. This is because jlink, by default, only bundles the required modules into a runtime image but does not generate a platform-specific executable that knows which module and main class to launch; without the `--launcher` option, the `java` binary in the image has no default entry point, so when run on a machine without a separate Java installation, it cannot resolve the main class. On the Oracle Java Foundations 1Z0-811 exam, this question tests your understanding of jlink’s limitations and the JPMS deployment workflow—a common trap is assuming that simply adding a module with `--add-modules` is enough to make the image executable. Remember: jlink creates a minimal JRE, but you must explicitly define the launch command; the `--launcher` option generates a script (e.g., `myapp`) that invokes `java --module com.myapp/com.myapp.Main`. Memory tip: “Link the launcher, or your app will flounder.”
1Z0-811 Exception Handling and Development Tools Practice Question
This 1Z0-811 practice question tests your understanding of exception handling and development tools. The scenario asks you to isolate a root cause — eliminate options that address a different problem before choosing. After answering, compare your reasoning against the explanation and wrong-answer breakdown below. Once you have made your selection, read the full explanation to reinforce the concept and understand why each distractor is designed to mislead on exam day.
You are responsible for deploying a Java desktop application that uses JavaFX and various third-party libraries. The application is modular and uses JPMS. To reduce the footprint and startup time, you decide to use jlink to create a custom runtime image that includes only the required modules. The application has a main module `com.myapp` that requires `javafx.controls`, `javafx.base`, and some other modules. After creating the runtime image using the command `jlink --module-path $JAVA_HOME/jmods:lib --add-modules com.myapp --output myapp-image`, you test the image on a development machine, and it works. However, when deploying to a customer's machine, the application fails to start with an error: "Error: Could not find or load main class com.myapp.Main". The customer's machine has no Java installed. The runtime image includes the `com.myapp` module. You verify that the `myapp-image/bin/java` launcher exists. The main class is correctly declared in the module-info.java of `com.myapp`. What is the most likely cause of this error?
Clue words in this question
Noticing these words before you look at the options changes how you read each choice.
Clue:
"most likely"Why it matters: Probability qualifier — the question wants the most probable cause or outcome, not a guaranteed one. Eliminate low-probability options.
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
Use the `--launcher` option in jlink to create a launcher script that automatically runs the main class with the correct module.
Option B is correct because the `jlink` tool does not automatically create a launcher script that specifies the main class for the runtime image. Without the `--launcher` option, the generated `java` launcher does not know which module and main class to execute, leading to the 'Could not find or load main class' error when no Java is installed on the customer's machine. Using `--launcher` creates a custom script (e.g., `myapp`) that invokes `java --module com.myapp/com.myapp.Main`, ensuring the correct entry point is used.
Key principle: Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Use the `--add-modules` option to include `javafx.controls` and other required modules in the command.
Why it's wrong here
The modules are already added; the issue is about launching the main class.
- ✓
Use the `--launcher` option in jlink to create a launcher script that automatically runs the main class with the correct module.
Why this is correct
The `--launcher` option generates a platform-specific script (e.g., myapp.sh or myapp.bat) that invokes the JVM with the correct module and main class, avoiding the need to specify them manually.
Clue confirmation
The clue word "most likely" in the question point toward this answer.
Related concept
Read the scenario before looking for a memorised answer.
- ✗
Add the `--bind-services` option to jlink to automatically include service provider modules.
Why it's wrong here
This does not affect the main class launcher; it is for service binding.
- ✗
Ensure that the `com.myapp` module reads all required modules by adding `requires` directives in module-info.java.
Why it's wrong here
If required modules were missing, the error would be different (e.g., module not found) and the application would have failed on the development machine as well.
Common exam traps
Common exam trap: answer the scenario, not the keyword
The trap here is that candidates assume the `java` launcher in the runtime image will automatically find the main class from the module descriptor, but in reality, without `--launcher`, the launcher requires explicit module and main class arguments, mimicking the standard `java` command behavior.
Detailed technical explanation
How to think about this question
When `jlink` creates a runtime image, it produces a `bin/java` launcher that behaves like the standard `java` command but with a restricted module set. Without the `--launcher` option, you must manually run `bin/java --module com.myapp/com.myapp.Main` to start the application. The `--launcher` option generates a platform-specific script (e.g., `myapp` on Linux/macOS or `myapp.bat` on Windows) that encapsulates this module and main class, making the image self-contained and executable without additional arguments. This is critical for deployment to machines without a JDK, as the default `java` launcher does not automatically resolve the main class from the module descriptor.
KKey Concepts to Remember
- Read the scenario before looking for a memorised answer.
- Find the constraint that changes the correct option.
- Eliminate answers that are true in general but not in this case.
TExam Day Tips
- Watch for words such as best, first, most likely and least administrative effort.
- Review why wrong options are wrong, not only why the correct option is correct.
Key takeaway
Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.
Real-world example
How this comes up in practice
A small business has 20 workstations on the 192.168.1.0/24 network and one public IP from its ISP. The router uses PAT (NAT overload) so all 20 devices share one public address using different source ports. NAT questions test whether you understand the four address terms and which direction each translation applies.
What to study next
Got this wrong? Here's your next step.
Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.
- →
Exception Handling and Development Tools — study guide chapter
Learn the concepts, then practise the questions
- →
Exception Handling and Development Tools practice questions
Targeted practice on this topic area only
- →
All 1Z0-811 questions
509 questions across all exam domains
- →
Oracle Java Foundations 1Z0-811 study guide
Full concept coverage aligned to exam objectives
- →
1Z0-811 practice test guide
How to use practice tests most effectively before exam day
Related practice questions
Related 1Z0-811 practice-question pages
Use these pages to review the topic behind this question. This is how one missed question becomes focused revision.
What is Java practice questions
Practise 1Z0-811 questions linked to What is Java.
Java Basics and Syntax practice questions
Practise 1Z0-811 questions linked to Java Basics and Syntax.
Primitives, Strings and Operators practice questions
Practise 1Z0-811 questions linked to Primitives, Strings and Operators.
Control Flow and Loops practice questions
Practise 1Z0-811 questions linked to Control Flow and Loops.
Arrays and Methods practice questions
Practise 1Z0-811 questions linked to Arrays and Methods.
Object-Oriented Programming practice questions
Practise 1Z0-811 questions linked to Object-Oriented Programming.
Exception Handling and Development Tools practice questions
Practise 1Z0-811 questions linked to Exception Handling and Development Tools.
1Z0-811 fundamentals practice questions
Practise 1Z0-811 questions linked to 1Z0-811 fundamentals.
1Z0-811 scenario practice questions
Practise 1Z0-811 questions linked to 1Z0-811 scenario.
1Z0-811 troubleshooting practice questions
Practise 1Z0-811 questions linked to 1Z0-811 troubleshooting.
Practice this exam
Start a free 1Z0-811 practice session
Short sessions build daily habit. Longer sessions build exam-day stamina. Try a timed session to simulate real conditions.
FAQ
Questions learners often ask
What does this 1Z0-811 question test?
Exception Handling and Development Tools — This question tests Exception Handling and Development Tools — Read the scenario before looking for a memorised answer..
What is the correct answer to this question?
The correct answer is: Use the `--launcher` option in jlink to create a launcher script that automatically runs the main class with the correct module. — Option B is correct because the `jlink` tool does not automatically create a launcher script that specifies the main class for the runtime image. Without the `--launcher` option, the generated `java` launcher does not know which module and main class to execute, leading to the 'Could not find or load main class' error when no Java is installed on the customer's machine. Using `--launcher` creates a custom script (e.g., `myapp`) that invokes `java --module com.myapp/com.myapp.Main`, ensuring the correct entry point is used.
What should I do if I get this 1Z0-811 question wrong?
Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.
Are there clue words in this question I should notice?
Yes — watch for: "most likely". Probability qualifier — the question wants the most probable cause or outcome, not a guaranteed one. Eliminate low-probability options.
What is the key concept behind this question?
Read the scenario before looking for a memorised answer.
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 →
Last reviewed: Jun 25, 2026
This 1Z0-811 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-811 exam.
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.
Sign in to join the discussion.