nerdexam
Oracle

1Z0-819 · Question #127

Which of the following commands is necessary to create and run a custom runtime image from Java source files?

The correct answer is B. javac, jlink. Option B (javac, jlink) is correct because creating a custom runtime image from source requires two distinct steps: javac compiles .java source files into bytecode (.class files), and jlink then assembles a custom, optimized JRE image containing only the modules your…

Java Platform Module System

Question

Which of the following commands is necessary to create and run a custom runtime image from Java source files?

Options

  • Ajavac, jdeps
  • Bjavac, jlink
  • Cjar, jlink
  • Djavac, jar

How the community answered

(26 responses)
  • A
    4% (1)
  • B
    73% (19)
  • C
    15% (4)
  • D
    8% (2)

Explanation

Option B (javac, jlink) is correct because creating a custom runtime image from source requires two distinct steps: javac compiles .java source files into bytecode (.class files), and jlink then assembles a custom, optimized JRE image containing only the modules your application needs.

Why the distractors are wrong:

  • A (javac, jdeps): jdeps is a dependency analysis tool - it tells you which modules your code uses, but it cannot produce a runnable runtime image.
  • C (jar, jlink): jar packages compiled classes into an archive, but it can't compile source files - you'd still need javac first; skipping compilation means there's nothing to package or link.
  • D (javac, jar): jar creates a JAR archive, not a custom runtime image - it won't produce a self-contained JRE you can distribute without a full JDK installed.

Memory tip: Think of the pipeline as "compile → link" - javac is the compiler and jlink is the linker, mirroring the classic compile/link stages in languages like C. The "j" in jlink stands for Java linking a runtime image together.

Topics

#module system#jlink runtime images#javac compilation#custom JDK

Community Discussion

No community discussion yet for this question.

Full 1Z0-819 Practice