Difference between JDK, JRE and JVM

This tutorial will help you to learn the difference between JDK, JRE and JVM.

JDK

Java Development Kit (JDK) is a kit which provides the environment to develop and execute java programs.

It is the superset of JRE (Java Runtime Environment) and includes tools for developing, debugging and monitoring the java applications.

JDK includes two things:

  • Development Tools: To provide an environment to develop your java programs.
  • JRE: To execute your java program.

Development part is the one, which contains utilities like javac, debugger, jar which helps in compiling the source code (.java files) into byte code (.class files).

The second part which is JRE helps in the running and execution of the byte code.

JDK is a platform specific software which conclude that we have separate installers for Windows, Mac and Linux systems.

Finally in short we can say that JDK is a bundle of software component that are needed to develop java based applications. If we want to write and then run the java program we need JDK installed.

Java Development Kit (JDK)

JRE

Java Runtime Environment (JRE) is the installation package which provide environment to only run (not develop) the java program onto your system.

It consists of JVM, the classes/packages, run- time libraries, and other significant supplementary components to run application and applets which is written in java. One more important thing is that JRE exists physically.

JRE is the superset of JVM and subset of JDK. JRE is smaller than JDK hence needs much less disk space and the reason behind this is, JRE does not contain java complier and other software tools needed to develop java programs. Have a look at the diagram below for better understanding.

Java Runtime Environment (JRE)

JVM

Java Virtual Machine (JVM) is the important part of JRE, which convert the byte code into machine code depending upon the hardware and underlying operating systems combo.

Actually JVM runs the program (.class file), it uses the java class libraries and the run-time libraries to execute those programs.

JVM is a platform dependent and virtual because it provides a machine interface that does not depend on the underlying operating system and machine hardware architecture.

Whatever java program you run using JRE or JDK goes into JVM and JVM is responsible to execute the java program line by line hence it is also known as interpreter.

JVM is the center of the java programming language and provides several key features to java programmer which includes crucial Memory managements and garbage collection, security and other system level services.

Difference between JDK and JRE

Some of the main differences between JDK and JRE is given in the tabular form have a look.

JDK JRE
Java development kit is needed for developing java applications. Java run-time environment is a plug-in needed for running java applications.
JDK contains tools for developing, debugging and monitoring java application. JRE does not contain tools such as compiler or debugger etc. Rather it contains class libraries and other supporting files that JVM requires to run the program.
It is the superset of JRE. It is the subset of JDK
JDK needs more disk space as it contains JRE along with various development tools. JRE is smaller than JDK so it needs less disk space.

Comment below if you found any information incorrect or missing in above tutorial for difference between JDK, JRE and JVM.

Leave a Reply

Your email address will not be published. Required fields are marked *