As a Java programmer, it is very important aspect to understand what exactly is JDK, JVM and JRE. Even in interviews, most of the interviewers ask difference between JDk, JVM and JRE to check the deep/logical understanding of JDK, JVM and JRE of candidate. Today in this article we will understand various difference between JDK, JVM and JRE.
As a developer, we write a Java program i.e
*.java file. Further we compile the Java program and the
*.class file is generated which is also known as bytecode. Now to execute this byte code we need a something. But what exactly is that? Java Virtual Machine(JVM) is a virtual machine which runs the Java
bytecode/.class file and generates the output. Every platform for example:- Linux, Windows, Mac-OS has their own JVM, which makes Java program prossible to write once and run anywhere. For example if you compile your program on Windows operating system, you can run the same program on any operating system and produce the same output as shown in below diagram:
Java Runtime Environment provides all necessary libraries and files which is required by JVM to execute any bytecode/.class file. For example: If you want to run any applet on your browser you have to install JRE on your system.
JDK also known as Java Development Kit which provides all necessary tools to develop any Java application as well as run it..
Hence, JDK = Tools Required to develop Java application + JRE
The tools provided by JDK to develop Java application are listed below:
In this article, you have learnt about JDK, JRE and JVM as well as key difference between each of them.