JVM, JRE, and JDK

Understanding the Java ecosystem components and their relationships

Java · beginner · 20 min · 6 steps · free

What you'll learn

JavaEcosystem.java

// Understanding JVM, JRE, JDK relationship
public class JavaEcosystem {
    public static void main(String[] args) {
        System.out.println("Source Code (.java)");
        System.out.println("↓ Compiled by JDK");
        System.out.println("Bytecode (.class)");
        System.out.println("↓ Executed by JVM");
        System.out.println("Machine Code");
    }
}

Step by step

  1. Java source code is written in .java files using human-readable syntax.
  2. JDK (Java Development Kit) contains the compiler (javac) that converts .java files to .class bytecode files.
  3. JDK (Java Development Kit) contains the compiler (javac) that converts .java files to .class bytecode files.
  4. Bytecode is platform-independent intermediate code stored in .class files.
  5. JVM (Java Virtual Machine) interprets bytecode and converts it to platform-specific machine code.
  6. JRE (Java Runtime Environment) = JVM + Libraries. It's needed to run Java applications.

·

More in Java Basics