JVM vs JRE vs JDK: Key Differences Explained
When you start learning Java, you'll quickly run into three closely related abbreviations: JVM, JRE, and JDK. They sound similar but mean different things. The simplest way to remember them is as nested layers: the JDK contains the JRE, and the JRE contains the JVM.
Java Components: JVM, JRE and JDK
What is the JVM (Java Virtual Machine)?
The JVM is the component that runs Java programs. It executes bytecode — the .class files produced by the compiler from your source code. Because every platform (Windows, Linux, macOS) has its own JVM, the same bytecode runs everywhere without changes. This is what makes Java platform-independent. The JVM also handles memory management through the garbage collector and uses JIT compilation to convert hot code paths into native machine code at runtime.
What is the JRE (Java Runtime Environment)?
The JRE is everything you need to run a Java application, but not to develop one. It consists of the JVM plus the standard class libraries (collections, I/O, networking, and so on) that programs rely on at runtime. The JRE does not include a compiler or developer tools.
Note: since Java 11, Oracle no longer ships a separate JRE. The JDK is distributed on its own, and if you need a minimal runtime, you build one from the JDK using the jlink tool.
What is the JDK (Java Development Kit)?
The JDK is the full toolkit for developing Java applications. It includes everything in the JRE (so the JVM and libraries), plus the compiler (javac), the launcher (java), the documentation tool (javadoc), the archiver (jar), a debugger, and other utilities. If you are writing Java code, this is what you install.
How JVM, JRE, and JDK relate
The three form a set of nested layers: the JDK is the outermost (development), the JRE sits inside it (runtime), and the JVM is at the core (execution). In short — you write code, javac from the JDK compiles it into bytecode, and the JVM runs that bytecode.
| Component | What it contains | Purpose | When you need it |
|---|---|---|---|
| JVM | The execution engine | Runs bytecode; memory management, JIT | Always (it runs every Java program) |
| JRE | JVM + standard libraries | Running Java applications | To run, but not develop, Java apps |
| JDK | JRE + compiler and dev tools | Developing Java applications | To write and compile Java code |
Frequently asked questions
What's the difference between the JDK and the JRE?
The JRE only lets you run Java programs (it's the JVM plus libraries). The JDK lets you develop them — it includes everything in the JRE plus the compiler and developer tools.
Do I need the JRE or the JDK?
If you're learning or writing Java, install the JDK. The JRE alone is only enough to run existing applications, and since Java 11 it isn't shipped separately anyway.
Is the JVM included in the JDK?
Yes. The JDK contains the JRE, and the JRE contains the JVM. Installing the JDK gives you all three.
Can I run Java without the JDK?
To run a program you only need a runtime (historically the JRE). But to compile .java files into bytecode you need the javac compiler, which comes with the JDK.
Video Explanation
Prefer video format? Watch this lesson with examples and explanations.
Comments