Master java skills

JDK, JRE, and JVM

It is important for all of us to understand JDK, JRE, and JVM. This is also an important interview question which is asked at beginner as well as advanced level.

JDK

JDK is abbreviation for Java Development Kit. It is complete development kit that java developers need in order to write programs and run them. JDK consists of JRE and JVM. Whenever, we install, JDK on our machine, we have the folder structure as shown below

This is complete JDK installation. As we can see, there is jre folder within it. One more folder which is important here is the ‘bin’ folder. It contains all the executables and tools like javac, java, javap etc.

JRE

JRE is abbreviation for Java Runtime Environment. As the name suggests, this provides runtime environment for java programs. Without JRE, a java program cannot be run on a machine. So, if you only want to run java program you only need JRE. It’s not mandatory to have complete JDK.

JRE is the implementation of JVM (Java Virtual Machine). It has its own set of libraries and binaries. JRE is platform dependent. Which means for different Operating Systems, JRE implementation would be different.

JVM

JVM is Java Virtual Machine. It is an abstract machine that provides all the specifications which any implementation of JVM must adhere to. Unlike JRE, JVM is platform independent because it only provides specification and not the actual implementation. Some of the responsibilities that JVM specifies are:

  1. Loading of program code
  2. Verification and execution of code
  3. Define memory area
  4. Garbage collection
  5. Runtime environment
  6. Error reporting etc.
JVM Architecture