To understand the difference between JDK, JRE, and JVM, this article has broken down the components into the following sub-headings:
JVM stands for Java Virtual Machine and works like an abstract machine. The Java Virtual Machine is truly ‘virtual’ as it is an abstraction that provides a runtime for Java code to be executed efficiently. The Java compiler changes the source code to byte code. This byte code is executed by the JVM thereby making Java programs platform-independent. The JVM is generally associated with three main notions namely specification, implementation, and instance. It is responsible for the following tasks:
- Loads code
- Verifies Code
- Executes Code
- Creates a conducive run-time environment.
JRE stands for Java Runtime Environment and is also often referred to as Java RTE. As the name suggests, JRE creates a runtime environment for Java code to run. Unlike the JVM, JRE is comprised of several libraries and other files that are called at runtime. Other than Oracle, the implementation of JRE is used by several other organizations like Sun Micro Systems.
JDK stands for Java Development Kit. This kit contains all the essential tools that are required to create Java applications and applets therefore it can be thought of a software development rubric. JRE is contained in the JDK as one of its components. The JDK is an implementation of any of the following Oracle-developed platforms:
- Standard Edition Java Platform
- Enterprise Edition Java Platform
- Micro Edition Java Platform
As a JVM is a must to develop a Java application, a private JVM is provided in the kit. Along with it are some other components like the interpreter/loader (java), a compiler (javac), an archiver (jar), a documentation generator (Javadoc), and other necessary tools to develop a complete Java Application.