Have you always been confused among the basic difference between JDK, JRE and JVM? I have got things simplified for you.

Have you always been confused among the basic difference between JDK, JRE and JVM? I have got things simplified for you.

To master anything, we need to first get a grip on the basics. Have you started your journey with java and/or have always wanted to understand the difference between JDK, JRE and JVM in simplified terms? Then,

Getting Started

The java source code(human readable .java file) does not directly gets converted to machine code(0s and 1s). First, it gets converted to byte code(.class file) which is an intermediate code between source and machine code.

And all of this is done by JDK, JRE and JVM.

Let's understand this workflow!

Java Development Kit, JDK

Imagine of a toolbox/toolkit. It has every tools inside it. Likewise, the Java Development Kit or simply JDK, provides the environment to develop and run the java program and has many tools for doing so.

It is basically a package which includes :

  • The development tools to provide an environment to develop our program
  • Archiver, documentation generator, interpreter/loader
  • Java Runtime Environment (JRE)
  • A compiler- javac

This javac compiler converts the source code into bytecode.

Java Development Kit (JDK) (1).png

Java Runtime Environment, JRE

As mentioned, the JDK contains the JRE. As the name suggests, it provides environment to only run the program.

It consists of :

  • User Interface toolkit
  • Deployment technology
  • Integration and base libraries
  • Java Virtual Machine (JVM)

Java Virtual Machine, JVM

As mentioned earlier, the source code is first converted to bytecode and then to machine code and javac compiler inside the JDK, converts the source code into bytecode.

Now, this bytecode cannot directly run on the system.

This is where the Java Virtual Machine (JVM) comes into play!

The JVM runs and interprets the bytecode line by line with the help of all the libraries and files provided by the JRE and converts the bytecode into machine code.

JDK JRE JVM (1).png

Conclusion

In this article, we have got to know about Java Development Kit, Java Runtime Environment and Java Virtual Machine in simple terms.

We noticed that the JDK is like a toolkit with all the important tools, among which javac compiler is the compiler which compiles the source code into bytecode. Inside JDK, there is JRE which is an environment to run our program. It contains the JVM and all the other libraries and files which are used by JVM to convert the byte code into machine code.

Thanks for reading! I hope I have been successful in explaining these terms in the simplest way possible. Feel free to like and share if you found this article helpful. Happy learning!