JDK vs JRE vs JVM

Three Important Terms

  • JVM (Java Virtual Machine): the engine that runs compiled Java code (bytecode). Each operating system has its own JVM.
  • JRE (Java Runtime Environment): JVM + the standard class libraries. Enough to run Java programs.
  • JDK (Java Development Kit): JRE + development tools such as javac (compiler), java (launcher), jar, javadoc, jshell. Needed to write and compile Java programs.

How They Fit Together

+---------------------------------------------------+
|  JDK  (Java Development Kit)                      |
|   javac, jar, javadoc, jshell, debugger ...       |
|  +---------------------------------------------+  |
|  |  JRE  (Java Runtime Environment)            |  |
|  |   standard libraries: java.lang, java.util  |  |
|  |  +---------------------------------------+  |  |
|  |  |  JVM  (Java Virtual Machine)          |  |  |
|  |  |   class loader, bytecode verifier,    |  |  |
|  |  |   interpreter + JIT compiler, GC      |  |  |
|  |  +---------------------------------------+  |  |
|  +---------------------------------------------+  |
+---------------------------------------------------+

Comparison

JVMJREJDK
Full formJava Virtual MachineJava Runtime EnvironmentJava Development Kit
Jobruns bytecodeprovides libraries + JVM to run appstools to develop, compile, debug
Containsinterpreter, JIT, GCJVM + librariesJRE + javac, jar, javadoc...
Who needs iteveryone running Javausers of Java appsdevelopers
Platform dependent?yes (one per OS)yesyes

Note: Java code is platform independent, but the JVM itself is platform dependent. That is exactly why your bytecode runs everywhere: each OS has its own JVM that understands the same bytecode.

Tip: Since Java 11, Oracle no longer ships a separate JRE download. You simply install the JDK.