The three components of Java are JDK, JRE, and JVM. In this post, we will learn the difference between JDK JRE and JVM in detail.
Table of Contents
Difference between JDK JRE and JVM
The following image illustrate all the detail that will be easier to remember.
JDK
JDK stands for Java Development Kit. It consists of all the tools that are needed to develop Java applications. JDK is platform dependent. Hence, we need to download it for each platform. There are different JDK available for different operating systems. JDK physically exists and contains JRE and JVM.
JRE
JRE stands for Java Runtime Environment. It is used to provide a runtime environment for Java applications. It is the implementation of JVM and it also physically exists like JDK. It is also platform dependent. We can find different implementations of JVM besides Oracle. For example Amazon Corretto.
JVM
JVM stands for Java Virtual Machine. It does not exist physically like JDK and JRE. It plays a important role to make Java very popular and platform independent. JVM is platform dependent like JDK and JRE because the configuration of each operating system is identical.
But Java is platform independent.
JVM mainly does the following things:
- To load class
- To verify code
- To execute code and
- To provide runtime environment
Summary
The summary of difference between JDK JRE and JVM in tabular form is given below:
JDK (Java Development Kit) | JRE (Java Runtime Environment) | JVM (Java Virtual Machine) | |
---|---|---|---|
Definition | A software development kit that includes tools for developing Java applications. | A runtime environment that allows the execution of Java programs. | A virtual machine that executes Java bytecode. |
Components | Includes the JRE, compiler (javac), debugger, and other development tools. | Includes libraries, JVM, and other components necessary to run Java applications. | Interprets Java bytecode and provides an execution environment for Java programs. |
Usage | Used for developing, compiling, and debugging Java applications. | Used for running Java applications without development capabilities. | Used for executing Java bytecode on various platforms. |
Dependency | Requires JRE for running Java applications. | Doesn’t require any additional components. | Doesn’t require any additional components. |
Example | Oracle JDK, OpenJDK | Oracle JRE, OpenJRE | HotSpot JVM, OpenJ9 JVM |