☕ Java
JDK, JRE and JVM — What's the Difference?
If you've installed Java and seen 'JDK' and 'JRE' and wondered what on earth the difference is — this clears it up for good. These three aren't interchangeable, and knowing which is which will save you headaches.
The Three Layers of Java
Every time you run a Java program, three components work together: the JVM, the JRE, and (if you're a developer) the JDK. They're nested inside each other like Russian dolls.
JDK ⊃ JRE ⊃ JVM
Let's break each one down with a real-world analogy.
JVM — Java Virtual Machine
The JVM is the engine that actually runs your Java bytecode. It doesn't care what OS you're on — it takes the .class bytecode files and executes them.
Analogy: Think of the JVM as a universal game console emulator. No matter what game (Java program) you load, the emulator knows how to run it on your specific hardware.
Key things the JVM does:
• Loads and verifies bytecode (security check before running)
• Executes instructions
• Manages memory — allocates it when you create objects, cleans it up when you're done (Garbage Collection)
• The JVM is platform-specific — there's a different JVM for Windows, Mac, and Linux, but they all run the same bytecode
JRE — Java Runtime Environment
The JRE is the JVM + the standard Java class libraries. When you just want to run a Java application (not develop it), you install the JRE.
Those libraries (java.lang, java.util, java.io, etc.) are pre-built utilities that come with Java — things like string manipulation, data structures, date/time handling, and more.
Analogy: The JRE is like a smartphone with all system apps pre-installed. You can run apps, but you can't build new ones without developer tools.
JDK — Java Development Kit
The JDK is the full package for developers. It includes the JRE (so you can run Java too) plus the tools you need to write and compile Java code:
• javac — the Java compiler (converts .java → .class bytecode)
• java — the launcher to run your compiled programs
• javadoc — generates documentation from your code comments
• jar — bundles your .class files into a single distributable .jar file
• jdb — a command-line debugger
Rule of thumb: If you're learning or building Java — install the JDK. If you're just deploying an already-compiled Java app on a server — the JRE is enough (though many setups just install the JDK everywhere to keep it simple).
Related Topics in Introduction
What is Java?
Java is a high-level, object-oriented programming language built on one killer idea: write your code once, and run it on any device — Windows, Mac, Linux, phone, smartwatch, you name it. No rewrites needed.
Features of Java
Java didn't become one of the world's most used languages by accident. From running on any device to handling millions of users simultaneously, here's what makes Java genuinely powerful — and why companies keep betting on it.
Uses of Java
Java powers everything from Android apps to banking systems, from Netflix's backend to NASA's mission control. Here's where Java is actually used in the real world — and why it keeps showing up in the most critical systems on the planet.
Java Editions (Java SE, EE, ME)
Java isn't one-size-fits-all. It comes in three distinct editions — each built for a different environment. Whether you're building a desktop app, a banking backend, or firmware for a SIM card, there's a Java edition designed exactly for that job.