Java.Core.What is the difference between JDK, JRE, and JVM?

📦 1️⃣ JVM (Java Virtual Machine)

What is it?

✅ The JVM is the heart of Java.
✅ It’s responsible for actually executing the bytecode (the compiled .class files).
✅ The JVM is platform-dependent (each OS has its own implementation), but the bytecode is platform-independent — that’s the “Write Once, Run Anywhere” magic.

What it does:

Loads the bytecode
Verifies it (security checks)
Interprets/Compiles (JIT) it into native machine code
Manages Memory (Garbage Collection)


📦 2️⃣ JRE (Java Runtime Environment)

What is it?

✅ The JRE is basically the JVM + essential libraries (like java.util, java.io, etc.)
✅ It’s enough if you only want to run Java programs, not develop them.


JRE contains:

✔️ JVM
✔️ Core Libraries (like collections, IO, networking, threading)


📦 3️⃣ JDK (Java Development Kit)

What is it?

✅ The JDK is the full package — it’s what developers install.
✅ It contains everything the JRE has, plus development tools.


JDK contains:

✔️ JRE (JVM + core libraries)
✔️ Compiler (javac) — to compile source code into bytecode
✔️ Debugger (jdb)
✔️ Other toolsjar, javadoc, javap, etc.


🚀 Simple Analogy

ThingReal-world analogy
JVMEngine that runs the program
JRECar ready to drive (engine + necessary parts)
JDKGarage with tools to build and fix the car (includes the whole car itself)

🎯 Summary Chart

ComponentContainsNeeded for
JVMExecutes bytecodeRunning programs
JREJVM + Core LibrariesRunning programs
JDKJRE + Compiler + ToolsDeveloping + Running programs

⚠️ Quick Tip

Use this if you want to:Install
Just run Java programsJRE (or JDK if JRE is removed in newer versions)
Develop Java programsJDK
This entry was posted in Без рубрики. Bookmark the permalink.