Nearby lessons
6 of 125Java - JDK, JRE and JVM
📌 What You Will Learn
- What Java is and why it is so popular
- The history and different versions of Java
- The important features of Java
- How Java is platform independent (Write Once, Run Anywhere)
- The difference between JDK, JRE and JVM
- How Java is different from C and C++
JDK, JRE and JVM is a core concept of the Java language. This lesson explains JDK, JRE and JVM — The Three Musketeers with complete, runnable code examples, clear step-by-step explanations, and common mistakes to avoid with exam-style MCQs at the end.
JDK, JRE and JVM — The Three Musketeers
Beginners get confused between these three words. Let us make them very clear:
| Name | Full form | What it does | Who needs it |
|---|---|---|---|
| JVM | Java Virtual Machine | Executes bytecode. Converts bytecode into machine code and runs it. | Only needed to run a .class file |
| JRE | Java Runtime Environment | JVM + ready-made library classes. Gives everything needed to run a Java program. | A normal user who only runs Java apps |
| JDK | Java Development Kit | JRE + development tools (javac compiler, javadoc, jar). Gives everything needed to write and run Java programs. | A developer who writes Java code |
Simple memory trick: JDK contains JRE, and JRE contains JVM.
In simple words: The JDK is the biggest box: it contains the JRE, and the JRE contains the JVM. Developers install the JDK, which gives them the tools to write, compile and run Java programs.
Trainer's Note: In old versions JRE was a separate download. From Java 11 onwards, Oracle gives only the JDK. The JRE is not sold separately anymore, because the JDK itself can run programs. When you install the JDK, you automatically get JRE and JVM inside it.
Example01
📝 Key Takeaways
- Java is a simple, secure, object-oriented programming language created by James Gosling at Sun Microsystems (now Oracle).
- Write Once, Run Anywhere (WORA): source code (.java) is compiled to bytecode (.class), and every JVM runs that same bytecode.
- JDK > JRE > JVM. JDK is for developers, JRE is for running, JVM executes bytecode.
- Important versions: Java 8 (LTS), Java 11 (LTS), Java 17 (LTS), Java 21 (LTS).
- Java is different from C/C++ because it has no pointers, automatic memory management, and is platform independent.
🧠 Test Your Knowledge
2 QuestionsProgress: 0 / 2