
JVM, JRE and JDK are the most common terms which are often heard in Java programming language and most people often confuse that these al are same. It is very important for a Java developer to know the concept of JDK,JRE and JVM. Once you understand these concepts well it would be very easy to discover the differences among them. In this article, we are going to describe the concepts of JDK, JRE and JVM and also the difference among them.
First we are going to describe, what is JVM ?, working and functionalities of JVM in details.
JVM(Java Virtual Machine): JVM is an abstract computing (virtual) machine. It provides a platform- independent way of executing codes. If you are a java programmer, you can concentrate on writing software, without having to be concerned with how and where it will run.
We all know that when we compile a Java file, we get the output as a '.class' file not an 'exe'. A '.class' file contains Java Byte codes which are executed by Java Virtual Machine. Java Virtual Machine interprets the byte code into the machine code depending on underlying operating system and hardware combination. JVM is platform dependent and responsible for garbage collection, array bound checking etc.
JVM is available for many hardware and software platforms. The main tasks of JVM are:
Load code
Verify code
Execute code
Provide run time environment

Why is it called Virtual? : It provides a machine interface that does not depends on underlying operating system and machine hardware architecture that's why it is called virtual. Due to this independence from hardware and operating system, it is possible to write once, run anywhere for Java programs.
There are several JVM implementation. They are different in things like performance, reliability, speed etc.

JDK (Java Development Kit): JDK is a container of tools which are needed to develop java programs. It is an acronym stands for Java development kit. It contains JRE and development tools where JRE is used to run the program. JDK facilitates a java programmer to write java applets and application.
JDK contains the tools like:
compiler (javac.exe), java application launcher (java.exe), Appletviewer etc.
Compiler: It converts java code into byte code.
Java application launcher: It is used to open a JRE, load the class and invoke its main method.
JRE (Java Runtime Environment): JRE is an acronym which stands for Java Runtime Environment. When the Java programming language was invented, it was not supported by all operating systems so there was a need of Java Runtime Environment which make able to run java applets and application after installing on your computer.
The JRE is developed by Sun Microsystems. It includes the JVM, code library and necessary components used to run java program.
Difference between JDK and JRE:
JDK
|
JRE
|
It is a container of software that is used to develop Java based application.
|
It is an implementation of JVM which actually execute Java programs.
|
It is needed to develop Java applications.
|
It is a plug-in which is used to run Java programs.
|
It needs more space because it contains JRE along with other developing tools.
|
It needs less space because it is smaller.
|
It includes the JRE, java compiler, set of API classes etc. to write Java application.
|
It includes the JVM, core libraries and other additional components to run java application.
|
Difference between JDK, JVM and JRE
ReplyDeletecool and nice