Why this matters
- Choosing the wrong download is the first thing that goes wrong for a beginner — a JRE cannot compile, so
javacis simply absent. - Docker images are sized around this distinction, and shipping a build toolchain into production is wasted space and extra attack surface.
- The relationship between the three is asked in almost every first-round interview, and a vague answer is noticed immediately.
What each one is
From the inside out
- JVM — Java Virtual Machine. The engine. It loads bytecode, verifies it, executes it, and manages memory. It is a specification with multiple implementations, and it cannot be installed by itself.
- JRE — Java Runtime Environment. The JVM plus the standard class library:
java.lang,java.util,java.io, the collections, everything your code imports without adding a dependency. This is the minimum needed to run a compiled program. - JDK — Java Development Kit. The JRE plus the development tools:
javacthe compiler,jarthe packager,javadocthe documentation generator,jdbthe debugger,javapthe bytecode viewer, andjshellthe interactive shell.
Which one you actually need
| Aspect | JRE is enough | JDK is required |
|---|---|---|
| Task | Running an already-built application | Compiling source, or building a jar |
| Typical user | A production server, an end user | A developer, a CI pipeline |
| Has javac | No | Yes |
| Disk footprint | Smaller | Larger |
| Frameworks that compile at run time | Not supported | Supported |
Task
JRE is enoughRunning an already-built applicationJDK is requiredCompiling source, or building a jarTypical user
JRE is enoughA production server, an end userJDK is requiredA developer, a CI pipelineHas javac
JRE is enoughNoJDK is requiredYesDisk footprint
JRE is enoughSmallerJDK is requiredLargerFrameworks that compile at run time
JRE is enoughNot supportedJDK is requiredSupported
In practice, install the JDK on your own machine and the smallest possible runtime in production.
Proving the difference
java -version # present in both a JRE and a JDK
javac -version # only present in a JDK
If the second command reports "command not found" while the first prints a version, you have a runtime and not a development kit. That is the whole diagnosis.
A single-file program can skip the explicit compile step entirely, which sometimes hides the distinction:
java Greeting.java # compiles in memory and runs — still needs a JDK
This is convenient for scripts, but it is the JDK's compiler doing the work behind the scenes. On a JRE the same command fails.
Specification versus implementation
The JVM is defined by a written specification, so several organisations build their own. They all run the same bytecode, but they differ in licensing and in extras.
- HotSpot is the reference implementation, used by Oracle JDK and by Eclipse Temurin. Its name comes from the way it detects hot code to compile.
- OpenJDK is the open-source codebase that nearly every distribution is built from. Amazon Corretto, Azul Zulu and Temurin are all builds of it.
- GraalVM adds ahead-of-time compilation to a native binary, trading away some dynamic features for near-instant startup.
For everyday work the practical advice is short: pick any current LTS build from a maintained distribution. The differences rarely affect application code.
Common misreadings
- "I will install the JVM." You cannot. It ships inside a JRE or a JDK and is not distributed on its own.
- "The JDK and the JRE are alternatives." They are nested. Installing a JDK already gives you everything a JRE has.
- "The JRE is just the JVM." The class library is the larger part of it. Without
java.utilnothing useful would run. - "A JDK is heavier so it is slower." Startup and throughput come from the JVM, which is identical in both. Only disk size differs.
Quick recall
Everything you need if you only revisit this box.
- The nesting is JDK ⊃ JRE ⊃ JVM: development tools wrap a runtime, which wraps the execution engine.
- The JVM executes bytecode and manages memory. The JRE adds the standard library. The JDK adds
javac,jar,javadoc,jdbandjshell. - Compiling needs a JDK; running a finished build only needs a runtime.
java -versionworks on both.javac -versionis the test for a JDK.- Oracle stopped shipping a standalone JRE after Java 11; use
jlinkto build a minimal runtime instead. - The JVM is a specification with many implementations — HotSpot, OpenJDK builds, GraalVM — all consuming identical bytecode.
Test yourself
Answer these before moving on — recall is what makes it stick.