JDK vs JRE vs OpenJDK: What Is the Difference?

These three terms confuse almost every Java newcomer. Short version: JRE runs Java programs, JDK compiles and runs them, OpenJDK is the free open-source codebase that most JDKs and JREs are built from.

JRE β€” Java Runtime Environment

The JRE is what you need to run Java programs. It contains:

  • The JVM (Java Virtual Machine) β€” executes bytecode
  • The Java Class Library β€” standard library (collections, I/O, networking, etc.)
  • Supporting files and configuration

If you download Minecraft, DBeaver, or any Java desktop application and just want to run it, a JRE is enough. Note: starting with Java 11, many OpenJDK vendors stopped distributing separate JRE packages β€” they distribute a full JDK, which includes everything the JRE has plus dev tools.

JDK β€” Java Development Kit

The JDK is a superset of the JRE. It adds:

  • javac β€” the Java compiler (source to bytecode)
  • jar β€” package tool
  • jdb β€” debugger
  • jconsole, jmap, jstack, jfr β€” profiling and diagnostic tools
  • Header files for native code (JNI)

If you are writing, compiling, or debugging Java code, you need the JDK. IDEs like IntelliJ IDEA require a JDK to compile your project.

In practice: just install the JDK. It is a superset of the JRE, typically only a few hundred MB larger, and eliminates any ambiguity.

OpenJDK β€” the open-source reference implementation

OpenJDK is neither a product you download nor a company β€” it is the open-source project that produces the official reference implementation of Java SE. Oracle leads the project and contributes the most code, but Red Hat, Amazon, Microsoft, SAP and many others contribute significantly.

From OpenJDK source code, several vendors build their own binary distributions:

NameVendorCost
Eclipse TemurinAdoptiumFree
Amazon CorrettoAWSFree
Microsoft Build of OpenJDKMicrosoftFree
Azul ZuluAzul SystemsFree community ed.
Oracle JDKOraclePaid for production
GraalVM CommunityOracle/GraalVM projectFree

Which should you install?

For development: install the JDK from Temurin (adoptium.net). It is free for all uses, actively maintained, and the most widely used OpenJDK distribution. For a production server where you only run pre-built JARs: the JRE build of Temurin or a container image (eclipse-temurin:21-jre) works and is smaller.

The JVM vs JDK vs JRE hierarchy

JDK
β”œβ”€β”€ JRE
β”‚   β”œβ”€β”€ JVM (just-in-time compiler, garbage collector, runtime)
β”‚   └── Class library (java.*, javax.*)
β”œβ”€β”€ javac (compiler)
β”œβ”€β”€ jar (packager)
└── jdb, jconsole, jmap... (dev tools)