In this chapter we are going to learn about three important terms:
JVM is an acronym for Java Virtual Machine
JRE is an acronym for Jun Runtime Environment
JDK is an acronym for Java Development Kit
After reading about three of them you can answer one of the most commonly asked question in java.
Difference between JDK, JRE and JVM
Java Virtual Machine
JVM is a virtual machine which is capable of reading the .class file that contains bytecode.
In java, compiler produces bytecode during compilation which can be run on any system that has JVM installed on it. This results in making java a portable programming language. It can be written on any system and run on different system easily irrespective of operating system. Thus java is also refered to as write once, run anywhere.
JVM pervforms three major tasks:
Read the bytecode
Verify the bytecode (it enhances security in java)
Link the code to library.
Java Runtime Environment
JRE provides environment to run java applications.
JRE contains supporting libraries, core classes and other components that JVM uses during the runtime.
JRE is part of JDK. It can also be downloaded separately to just only run java application and applet.
Java Development Kit
JDK comprises of JRE and other tools that helps in developing, debugging & monitoring the java application.
A JDK always comprises of:
Java interpreter or loader (java)
document generator (javadoc)
Two commonly used JDK tools are java (to run java application) and javac (to compile java application).
To run java application and applet you only need JRE.
To develop java application and applet as well as run them JDK is needed.