PROGRAMMING FUNDAMENTALS › JAVA FUNDAMENTALS
For the same Java program, these names describe different responsibilities. The JDK provides the tools used to create and compile Greeting.java. The JRE provides the support a finished program needs while it runs. The JVM is the execution engine that reads Java bytecode and carries out its instructions.
Greeting.java is the source code you start with. Greeting.class is the bytecode produced from that source. The JDK is involved in creating the class file, the JRE supplies the runtime setting, and the JVM executes the class file. Calling all three names interchangeable hides the boundary between building a program and running it.
Which component must be installed to modify and compile Greeting.java?
Checkpoints are not graded. They are here so you catch yourself before the quiz does — stuck, ask the tutor on the right.
The journey starts with javac, the compiler provided by the JDK. When you compile Greeting.java, javac translates the source code into Java bytecode and writes that bytecode to Greeting.class. The JVM does not receive the source file at this stage, and it does not create the class file.
javac Greeting.java
# javac creates Greeting.class
java Greeting
# the java launcher starts the JVM, which executes Greeting.class
# output:
Hello, MiraThe java launcher is the command that starts the runtime for the class you name. In this case, java Greeting starts a JVM and selects Greeting.class. The JVM reads the bytecode, uses the available runtime support, and the program displays Hello, Mira. Compilation and execution are separate actions, even when you type them one after another.
A JVM is the execution engine, but it is not the whole runtime environment. Conceptually, a JRE combines a JVM with Java runtime libraries. Those libraries provide standard capabilities that a running program can use, while the JVM handles the execution of the bytecode. For Greeting.class, the JRE role is the surrounding runtime support, not the creation of the class file.
The JDK is the broader development environment. Conceptually, it adds tools such as javac to the runtime components needed to run Java programs. This is why installing a JDK can support both stages: javac can create Greeting.class, and the included runtime components can start it.
Replace the incorrect component name with the exact tool name: "The JVM compiles Greeting.java into Greeting.class".
The JVM compiles Greeting.java into Greeting.classCheckpoints are not graded. They are here so you catch yourself before the quiz does — stuck, ask the tutor on the right.
Modern Java installations do not always provide a separately named JRE download. A full JDK commonly includes the runtime components, and a custom runtime can be built with only the pieces an application needs. This changes how the software is packaged, not what the roles mean: development tools build the program, runtime libraries support it, and the JVM executes its bytecode.
Greeting.class is not tied to one operating system in the same way a native executable usually is. The unchanged file can be copied to Windows 11 and Ubuntu 24.04. On each system, the java launcher starts a JVM implementation built for that operating system, and that JVM reads the same Java bytecode.
Java portability does not mean that one JVM executable runs everywhere. Windows 11 uses a JVM built for Windows, while Ubuntu 24.04 uses a JVM built for Linux. Their platform-specific implementations provide the connection to their operating systems, while the shared bytecode lets both executions represent the same Greeting.class behavior and display Hello, Mira.
| OPERATING SYSTEM | INPUT TO THE JVM | EXECUTION RESULT |
|---|---|---|
| Windows 11 | The unchanged Greeting.class | Hello, Mira |
| Ubuntu 24.04 | The unchanged Greeting.class | Hello, Mira |