In this tutorial we will study and understand the difference between JDK vs JRE vs JVM in Java Programming. It is very important concept which needs to be very clear theoretically and is a fundamental concept needed to understand the execution process of a Java Program in general.
JVM – Java Virtual Machine
JVM (Java Virtual Machine) is an abstract machine. It is a specification that provides runtime environment in which java bytecode can be executed. JVM is not platform independent i.e. there are separate JVMs for different OS platforms like MacOS, Windows, Linux etc.
The JVM performs following main tasks:
- Loads code
- Verifies code
- Executes code
- Provides runtime environment
JRE – Java Runtime Environment
It is used to provide runtime environment. It is the implementation of JVM. It physically exists. It contains set of libraries + other files that JVM uses at runtime. JREs are also developed and released for various platforms (thus even JRE is not platform independent) by different companies other than Sun Micro Systems. JRE = JVM + Library Files
JDK – Java Development Kit
JDK is the whole development kit which is basically the packaging of JRE + Development tools. It physically exists and it also is not platform independent, thus different platforms need different JDKs