What Is the Difference Between JDK and JRE?
Understanding the distinction between the Java Development Kit (JDK) and the Java Runtime Environment (JRE) is fundamental for anyone working with Java. In short, the JDK is a comprehensive software development package used to write, compile, and debug Java applications, whereas the JRE is the execution environment designed purely to run already-compiled Java programs. While developers require the full JDK to build software from source code, end users or production servers running pre-built applications typically only need runtime execution capabilities.
Understanding the Java Runtime Environment (JRE)
The Java Runtime Environment acts as the execution layer for Java applications. Java programs do not compile directly into native machine code for a specific operating system; instead, they compile into bytecode. The JRE contains everything required to load and execute that bytecode on a target machine.
Key components of the JRE include:
- Java Virtual Machine (JVM): The engine that reads and executes compiled bytecode, translating it into platform-specific machine instructions.
- Core Class Libraries: Pre-built binary collections
(such as
java.lang,java.util, andjava.io) that provide essential functionality like collections, networking, and file I/O. - Supporting Files and Configuration: Property files, security policies, and resource bundles required to sustain runtime operations.
Because the JRE contains no compilers, software engineers cannot use
a standalone JRE to turn .java source files into executable
.class files.
Understanding the Java Development Kit (JDK)
The Java Development Kit is a superset of the JRE. It provides the full environment needed not only to run Java applications but also to write, assemble, inspect, and package them.
In addition to containing an entire runtime environment, the JDK includes a suite of development utilities:
- javac: The primary Java compiler that transforms
human-readable
.javasource code into.classbytecode files. - jar: The packaging tool used to compress and bundle multiple class files and resources into a single Java Archive (JAR) file.
- jdb: The Java Debugger, which allows developers to inspect running threads, set breakpoints, and examine state variables.
- javadoc: A documentation generator that extracts structured API documentation from annotations and source code comments.
- Profiling and Monitoring Utilities: Tools such as
jconsoleandjstatused to analyze memory consumption, thread performance, and garbage collection behavior.
Core Architectural Differences
The functional relationship between the two packages is hierarchical: the JDK contains the JRE, and the JRE contains the JVM.
| Feature | Java Runtime Environment (JRE) | Java Development Kit (JDK) |
|---|---|---|
| Primary Target | End users and execution environments | Software engineers and developers |
| Main Function | Executes compiled Java bytecode | Builds, compiles, packages, and runs code |
| Contains Compiler? | No (javac is absent) |
Yes (includes javac and build tools) |
| Includes Debugging Tools? | No | Yes (includes jdb, jconsole, etc.) |
| Package Composition | JVM plus core runtime libraries | Complete JRE plus development tools |
Modern Java Packaging Changes
Starting with Java 9 and solidified in Java 11, Oracle and the
OpenJDK community reorganized the distribution model. The standalone JRE
installer was largely deprecated in favor of modular runtime creation
via jlink. Modern developers download the JDK and can use
modularity tools to produce slimmed-down, custom runtimes containing
only the specific components required by their application, blurring the
old manual installation separation while keeping the underlying
conceptual distinction intact.