Everyone who has been and will be working on the Java language will know the concepts of JDK, JRE and JVM. So do people know what they are and the difference between them? In this tutorial, I will make clear to everyone to have a better view.
First, I will talk about JDK. JDK, stands for the Java Development Kit, is a suite of tools that provide the environment for us to build, develop, and execute Java applications.
JDK includes two things:
- Development tool: It provides us with an environment for developing Java applications. It contains useful utilities such as javac, debugger, jar that compile source code (.java files) into byte code (.class files).
- JRE: to execute Java programs. It helps us to run and execute byte code.
Normally, to begin programming with the Java language, we must install the JDK.
What about JRE? As I mentioned earlier, the JRE, which stands for Java Runtime Environment, is an installation package that only helps us execute Java applications, noting that the only purpose is to run, without development.
JRE will contain JVM, classes, libraries to run runtime Java applications.
So, if the demand is just running Java applications, you just need to install JRE.
Finally, what is the JVM? JVM, short for Java Virtual Machine, is an important part of the JRE, which converts byte code into machine code that makes our program executable.
Whether you install the JDK or the JRE, the JVM is still the main component of the Java application.
JVM provides a number of functions for us to manage memory, garbage collection, security and some other useful functions.
In a nutshell, the relationship and differences between JDK, JRE and JVM we can describe in the following figure: