Java Architecture — JDK, JRE & JVM Explained
This page explains the three core components that make Java platform-independent and powerful: JDK, JRE, and the JVM. Save this as a quick reference for interviews and exams.
Overview
Java’s architecture is designed around the idea of portability and security. The three pillars:
- JDK — Java Development Kit (for developers)
- JRE — Java Runtime Environment (to run Java programs)
- JVM — Java Virtual Machine (executes bytecode)
Together they enable the famous motto: Write Once, Run Anywhere (WORA).
JDK — Java Development Kit
The JDK is the full kit for developing Java applications. If you plan to write and compile Java code, you need the JDK.
What JDK contains: the Java compiler (javac), the JRE, debugging tools, and utilities like jar, javadoc, etc.
Developers use the JDK to compile source code into bytecode (.class files) which the JVM later executes.
JRE — Java Runtime Environment
The JRE provides the runtime libraries and the JVM — everything required to run Java applications.
JRE includes: the JVM implementation, core class libraries (rt.jar or modules), and configuration files for runtime.
End users who only need to run Java programs (not develop) typically install the JRE or use a JVM bundled with the OS or container image.
JVM — Java Virtual Machine
The JVM is the heart of Java. It reads bytecode (.class files), verifies them for safety, and executes them on the host machine.
Key responsibilities of the JVM:
- Class loading (ClassLoader subsystem)
- Bytecode verification (security)
- Execution: interpreter + JIT (Just-In-Time) compiler
- Memory management and garbage collection
- Providing runtime environment abstractions
The JVM abstracts away OS and hardware differences — so the same bytecode runs across platforms.
Execution Flow: Source → Bytecode → Native Code
Step-by-step how Java runs your program:
- Write Java source file:
Hello.java - Compile with
javac(JDK) → producesHello.class(bytecode) - Load the class: JVM ClassLoader loads
Hello.class - Verify bytecode for security and correctness
- Execute: JVM interprets or uses the JIT compiler to produce optimized native code
- Run on the host OS — same bytecode, different machines
Note: The JIT compiler compiles "hot" methods to native code at runtime, dramatically improving performance compared to pure interpretation.
Summary & Why It Matters
- JDK — the developer kit (compile & package)
- JRE — runtime libraries + JVM (for running apps)
- JVM — executes bytecode, provides portability & security
- Java's layered architecture is the reason it became dominant in enterprise systems, cloud, and Android ecosystems.
- Understanding this architecture helps you debug, tune, and deploy Java applications with confidence.