What are the differences between JVM, JRE, and JDK?
The JVM, JRE, and JDK are nested components of the Java platform, each building on the previous. Understanding their boundaries is essential for knowing what to install in different contexts.
The JVM (Java Virtual Machine) is the runtime engine that executes Java bytecode. It is an abstract specification implemented by vendors (Oracle HotSpot, OpenJ9, GraalVM). The JVM handles bytecode interpretation and JIT (Just-In-Time) compilation to native machine code, memory management and garbage collection, thread scheduling, and security sandboxing. Crucially, the JVM is platform-specific — there is a different JVM binary for Windows, Linux, and macOS — but it presents a uniform interface to Java bytecode, which is platform-neutral.
The JRE (Java Runtime Environment) packages the JVM together with the standard class libraries (java.lang, java.util, java.io, etc.) and supporting files needed to run compiled Java applications. If you only need to run a Java program — not develop one — the JRE is sufficient. Note: since Java 11, Oracle no longer distributes a standalone JRE; the JDK ships with a full runtime, and `jlink` can create minimal custom runtimes.
The JDK (Java Development Kit) is the full developer toolchain. It includes everything in the JRE plus: the Java compiler (`javac`), the archiver (`jar`), documentation generator (`javadoc`), debugger (`jdb`), and other development tools. You need the JDK to compile `.java` source files into `.class` bytecode and to build, package, and debug Java applications.
The relationship: JDK ⊃ JRE ⊃ JVM. In production deployments, you typically install only the JRE (or a JDK, now that they're merged) and ship pre-compiled JARs. On developer machines, you always need the JDK.
| Aspect | JVM | JRE | JDK |
|---|---|---|---|
| Purpose | Execute bytecode | Run Java applications | Develop and run Java applications |
| Contains | Bytecode interpreter + JIT + GC | JVM + standard libraries | JRE + compiler + dev tools |
| Platform-specific? | Yes | Yes | Yes |
| Includes javac? | No | No | Yes |
| Use case | Core runtime engine | End-user / production runtime | Developer machines / CI builds |
| Standalone since Java 11? | Yes (inside JDK) | No (merged into JDK) | Yes |
| Who needs it | Implicitly used by JRE | App deployment servers | Every Java developer |
Correctly identifies the containment hierarchy (JDK ⊃ JRE ⊃ JVM) and knows that JDK includes the compiler while JRE does not. Distinguishes runtime-only from development contexts.
Explains what the JVM actually does (bytecode execution, JIT, GC), notes that the JVM is platform-specific while bytecode is platform-neutral, and mentions the Java 11 consolidation of JRE into JDK.
Reading the answer is step one. Explaining it unprompted — under interview pressure — is what actually matters. Get AI-graded feedback on your answer with follow-up probes on your weak points.
Get Graded — Free Assessment