← Chapter 1 — Getting Started with Java

3. JDK, JRE & JVM

mixed

Description

The JDK is the toolkit used by developers. It includes the compiler, documentation tools, and a runtime environment.

The JVM is the engine that executes Java bytecode. The term JRE traditionally described the runtime pieces, although modern Java distributions commonly package the runtime with the JDK.

How the JDK, runtime libraries, and JVM work together.
How the JDK, runtime libraries, and JVM work together.

Subtopics

JDK

Description

The Java Development Kit is for creating software.

Explanation

It contains javac, java, debugging tools, and libraries.

Example

javac VersionCheck.java

JVM

Description

The Java Virtual Machine runs bytecode.

Explanation

Different JVMs can execute the same compiled class file.

Example

java VersionCheck

Explanation

Think of the JDK as a workshop, bytecode as the finished instruction set, and the JVM as the machine that follows those instructions. This division is central to Java portability.

Example

public class VersionCheck {
    public static void main(String[] args) {
        System.out.println(System.getProperty("java.version"));
    }
}

Key points

  • JDK includes development tools.
  • JVM executes compiled bytecode.
  • Java runtime libraries support programs.

Video

Open video

Open reference