Java JDK, JRE and JVM
In this tutorial, you will learn about JDK, JRE, and JVM and the main differences between them.
What is JVM?
JVM (Java Virtual Machine) is an engine that provides a runtime environment to execute a Java program.
When we execute a Java program, a Java compiler first compiles the Java code to bytecode. And after, the JVM translates it into native machine code (a set of statements that a computer's CPU can run directly).
The machine language for JVM is bytecode, making it easier for the compiler to generate bytecode for JVM rather than different machine codes for each type of machine (Linux, Windows, macOS ...).
Java is a cross-platform language. It means it is a platform-independent language. So when we write Java code, we write it for the JVM and not for the physical machine. The JVM executes the Java bytecode, which is platform-independent. This is why Java is a cross-platform language. To promote the cross-platform, Sun Microsystems created a slogan "Write once, run anywhere" (WORA) that became well known in the Java community.

What is JRE?
JRE (Java Runtime Environment) is the environment within which the JVM runs.
JRE contains Java Virtual Machine (JVM), Java class libraries, and other components required to run Java applications. But, JRE does not contain development tools such as compiler and debugger.
JRE is the superset of Java Virtual Machine (JVM).

What is JDK?
JDK (Java Development Kit) is a software development kit required to develop applications in Java. When you download JDK, JRE is included with it.
JDK is superset if JRE. It contains everything that JRE has along with the development kit, such as compiler, JavaDoc, debugger, etc.

To download the Java Development Kit (JDK), you can visit the following website: download JDK.
Relationship between JDK, JRE, and JVM

Here are the main components of JDK:
JDK and JRE
: The JDK allows developers to create core Java programs that can be run by the JRE, which includes JVM and class libraries.Class Libraries
: It is a group of dynamically loadable libraries that the Java program can call at run time.Compilers
: It is a Java program that accepts the developer's text files and compiles them into Java class files. The compiler outputs Java bytecode. In Java, the main compiler is JavacDebuggers
: Debugger is a Java program that lets developers test and debugs Java programs.JavaDoc
: It is documentation made by Sun Microsystems for Java. JavaDoc can be used to generate API documentation in HTML files directly from the source program.