Skip to content
  • JDK, JRE & JVM · Java

JDK, JRE & JVM

LearnViaNotes @learnvianotes· 2 min read

Three nested boxes: the JDK (tools to build) contains the JRE (what's needed to run) which contains the JVM (the engine that executes bytecode).

JDK = JRE + development tools (javac, jar, javadoc, jdb, jshell…)

JRE = JVM + class libraries (java.lang, java.util, …)

What each one is

JDKJREJVM
PurposeDevelop + runRunExecute bytecode
Contains javac?YesNoNo
Contains class library?YesYesNo
Platform dependent?YesYesYes

Inside the JVM

  1. Class loader subsystem

    Finds .class files, loads them, links (verify → prepare → resolve) and initialises them.

  2. Runtime data areas

    Heap (objects), Method Area / Metaspace (class metadata), one Stack per thread (frames with local variables), PC registers, native method stacks.

  3. Execution engine

    Interpreter + JIT compiler (C1 quick, C2 optimising) + Garbage Collector.

  4. JNI / native libraries

    Bridge to C/C++ code (native methods).

Checking what you have

Java
public class Main {
    public static void main(String[] args) {
        System.out.println("feature version: " + Runtime.version().feature());
        System.out.println("spec version:    " + System.getProperty("java.specification.version"));
        System.out.println("class file ok:   " + (Main.class.getName().equals("Main")));
    }
}
Output
feature version: 21
spec version:    21
class file ok:   true
Terminal
$ java -version          # runtime version
$ javac -version         # compiler version (only in a JDK)
$ echo $JAVA_HOME        # where the JDK is installed

OpenJDK distributions

All major builds come from the same OpenJDK source; they differ in licensing, support length and extras.

Eclipse Temurin · Amazon Corretto · Oracle JDK / Oracle OpenJDK · Azul Zulu · Microsoft Build of OpenJDK · GraalVM

What is the difference between JDK, JRE and JVM?

Is the JVM platform independent?

What is the JIT compiler?

Free for students and teachers

Write notes like this one

Cards for every idea, quizzes and flashcards, read aloud — on the web and your phone.

Something wrong with this note? Open it to report