In this post we will have brief explanation of JVM, JRE and JDK in Java.
JVM is the short form of Java Virtual Machine is an abstract layer between a Java program and the platform that Java Program is running on. JVM is platform dependent and different implementations of JVMs are available for specific platforms (We have different JVM for deferent operating Systems).
A Java program can run on any specific platform only when –
JVM has been implemented for that specific platform and it has been installed on that platform.
The JVM cannot understand Java program (source code) as we write it, it understands the “.class” file which we get by compiling the .java source file. This “.class” file contains the bytecode understandable by the JVM. It is because of JVM that Java is called a “portable language” (write once, run anywhere (WORA))
JRE is the short form of Java Runtime Environment provides the libraries, the Java Virtual Machine, and other components to run applets and applications written in the Java programming language.
The compiled bytecode doesn’t run on CPU directly, JVM sits in between and interpret the bytecode into readable machine language for the CPU. JRE enables Java bytecode to run on any platform. Bytecodes are interpreted by the JVM, at runtime classes found in the JRE when they need to perform actions, they cannot do by themselves
JDK is the short form of Java Development Kit is a superset of the JRE, and contains everything that is in the JRE, It also includes development tools such as the compilers and debuggers necessary for developing applets and java applications.
Note: JVM, JRE and JDK are platform dependent that’s why we have different JVM, JRE and JDK for different operating Systems. You would have observed when you go to Download JDK from oracle website you have option to choose JDK for different OS (like Linux,Mac OS,Solaris and Windows)