Difference between JDK, JRE, JVM and JIT in java

This is also a popular interview question if you are going for two to four years of experience. Let’s understand in this way. Imagine whole human body as JDK, hands and legs  as JRE and heart as JVM. Let’s see one by one.

Java Development kit(JDK) – 

  1. JDK stands for java development kit, is a main component which contains JRE,JVM and JIT.
  2. JDK used to develop and run the java program.
  3. Observe the below diagram, we have JRE inside JDK.

Java Runtime Envirnment (JRE) – 

  1. JRE contains JVM which is used to run java program.
  2. Inside JRE we have bin and lib.

3. Bin folder contains different types of dll files and exe files. We can see  jvm.dll here.

4.  Lib folder contains different jar files. One of important jar is rt.jar which contains all classes and interfaces which belongs to lang,util and io package.

Java virtual machine (JVM) – 

  1. JVM stands for Java Virtual Machine,  is heart of java programming language.
  2. It provides interpreter and JIT.
  3. JVM converts java byte code to machine language.

 

Just In Time Compiler(JIT) – 

  1. JIT stands for just in time compiler.
  2. It instruct interpreter to execute java byte code fast. It is used to improve the performance of java program execution.