Member-only story
What is JVM, JDK, and JRE?Explained in Simple Words (Notes)
Java has a powerful architecture that makes it platform-independent, secure, and robust. But to truly understand how Java works, you need to know the difference between:
- 🔥 JVM (Java Virtual Machine)
- 📦 JRE (Java Runtime Environment)
- 🛠️ JDK (Java Development Kit)
1️⃣ JVM (Java Virtual Machine)
🧠 JVM is the brain behind Java.
What it does:
- It runs Java bytecode (compiled
.class
files). - Converts bytecode into machine-specific instructions.
- Provides features like: Garbage collection, Memory management, Security and runtime optimization.
Analogy:
Think of JVM as a translator who reads your bytecode and speaks to your operating system in its own language (machine code).
Important:
Every OS (Windows, macOS, Linux) has its own version of JVM.
2️⃣ JRE (Java Runtime Environment)
⚙️ JRE is a software package that contains everything needed to run a Java program.
What it includes:
- JVM (Java Virtual Machine)
- Libraries and class files needed at runtime (like
rt.jar
) - Other supporting files
What it doesn’t include:
- Compiler (
javac
) - Development tools
✅ Use JRE when you want to RUN Java programs only (not develop them).
3️⃣ JDK (Java Development Kit)
🧑💻 JDK is the full toolbox for Java developers.
What it includes:
- JRE (which includes JVM)
- Java compiler (
javac
) - Debugger (
jdb
) - Other dev tools (like
jar
,javadoc
, etc.)
✅ Use JDK when you want to WRITE, COMPILE, and RUN Java programs.
Popular JDKs:
- Oracle JDK
- OpenJDK
- Amazon Corretto
- Eclipse Temurin