Skip to content
Java introduction 3 min read

JDK vs JRE vs JVM

Newcomers often blur the lines between the JVM, JRE, and JDK. They are three nested layers of the Java platform, each with a distinct role. Getting them straight clarifies how Java code is built, distributed, and executed.

The Big Picture

These three components form a containment hierarchy: the JDK contains the JRE, which contains the JVM.

┌─────────────────────────────────────────────┐
│  JDK  (Java Development Kit)                 │
│  Compiler (javac), debugger, javadoc, jar   │
│  ┌───────────────────────────────────────┐  │
│  │  JRE  (Java Runtime Environment)      │  │
│  │  Core libraries, class loader         │  │
│  │  ┌─────────────────────────────────┐  │  │
│  │  │  JVM  (Java Virtual Machine)    │  │  │
│  │  │  Executes bytecode, JIT, GC     │  │  │
│  │  └─────────────────────────────────┘  │  │
│  └───────────────────────────────────────┘  │
└─────────────────────────────────────────────┘

           JDK ⊃ JRE ⊃ JVM

The JVM: Java Virtual Machine

The JVM is an abstract computing machine — a specification that any vendor can implement — that executes Java bytecode. It is the component responsible for the “Run Anywhere” half of Java’s promise: the same .class file runs on any compliant JVM.

Key JVM responsibilities:

  • Class loading — locating and loading .class files into memory.
  • Bytecode verification — ensuring code is safe before running it.
  • Execution — interpreting bytecode and, via the JIT compiler, compiling hot paths to native code.
  • Garbage collection — reclaiming unused memory automatically.

Note: The JVM is platform-specific even though bytecode is platform-independent. There is a different JVM build for Windows, macOS, and Linux — each translates the same bytecode to its host’s native instructions.

The JRE: Java Runtime Environment

The JRE is what you need to run an existing Java application. It bundles the JVM together with the core class libraries (java.lang, java.util, java.io, and so on) and supporting files.

If you only want to execute a Java program someone else built — and not compile any code — the JRE is sufficient.

Tip: Since Java 11, Oracle and most distributions no longer ship a standalone JRE download. Instead you install a full JDK, and tools like jlink let you build a slim custom runtime image when you need a minimal footprint.

The JDK: Java Development Kit

The JDK is the full toolkit for developing Java applications. It is a superset of the JRE, adding the tools that turn source code into runnable bytecode.

Tools included with the JDK:

ToolPurpose
javacCompiles .java source into .class bytecode
javaLaunches the JVM to run a program
jarPackages classes into .jar archives
javadocGenerates HTML API documentation from comments
jdbCommand-line debugger
jshellInteractive REPL for evaluating Java snippets
jlinkBuilds custom runtime images

Side-by-Side Comparison

AspectJVMJREJDK
Full nameJava Virtual MachineJava Runtime EnvironmentJava Development Kit
Primary purposeExecutes bytecodeRuns Java applicationsDevelops Java applications
ContainsJVM + librariesJRE + dev tools
Includes compiler?NoNoYes (javac)
Who needs itUnderlies the othersEnd users running appsDevelopers writing apps

From Source to Execution

The flow that ties all three together:

HelloWorld.java  --[javac, from JDK]-->  HelloWorld.class (bytecode)
HelloWorld.class --[java launcher]-->    JVM loads, verifies, JIT-compiles, runs
public class HelloWorld {
    public static void main(String[] args) {
        System.out.println("Built by the JDK, run by the JVM!");
    }
}

Output:

Built by the JDK, run by the JVM!

Interview Questions

What is the difference between the JDK and the JRE? The JRE provides everything needed to run Java programs (JVM plus core libraries). The JDK is a superset that also includes development tools like the javac compiler, so it is what you need to build programs.

Is the JVM platform independent? The bytecode it runs is platform independent, but the JVM itself is platform specific — each operating system requires its own JVM implementation.

Can you run a Java program with only the JVM? Not in practice. The JVM needs the core class libraries (provided by the JRE) to do anything useful, since even System.out.println depends on them.

Last updated June 1, 2026
Was this helpful?