Difference between JDK, JRE, and JVM

In this post, we will see the major differences between JDK, JRE, and JVM.

JDK (Java Development Kit): JDK is the one you need to build applications in Java, it contains everything that is required to build and run Java applications. When you download java from the oracle site to develop applications you actually download JDK, which comes with JRE and the following Devtools,

JavaC: Java Compiler which compiles your Java code.
Java: Interpreter/loader which reads your java code.
JavaDoc: This helps in generating java documentation for your code.

JRE (Java Runtime Environment): JRE contains everything to run the java application, it contains code libraries required to develop java applications. JRE contains the Java class libraries, the Java class loader, and the Java Virtual Machine. In this system:
The class loader is responsible for correctly loading classes and connecting them with the core Java class libraries. The JVM is responsible is to ensure Java applications have the resources they need to run and perform well in your device or cloud environment.
The JRE is an orchestrator between these components.

JVM (Java Virtual Machine): JVM is machine-specific and can only read byte code that has been generated using java compiler.  Once the java compiler compiles the code to byte code, JVM is the one which reads it and runs on that machine, you might have heard that Java is portable, this is what it meant the compiled byte code can be run on any machine with the help of JVM.

Java Conceptual Diagram
Image Courtesy Oracle.com

You might have seen the below image saying Java is being run on 3 billion devices, it actually means JVM is running.

3 Billion devices run java

Here is the basic intro to Java Programming Language.