Differences between JDK,JRE and JVM
To understand differences between JDK vs JRE vs JVM,let us understand each
and every concept that defines JDK (Java Development Kit), JRE (Java Runtime
Environment), and JVM (Java Virtual Machine).
and every concept that defines JDK (Java Development Kit), JRE (Java Runtime
Environment), and JVM (Java Virtual Machine).
Article consist of following main topics:
1. JDK(Java Development Kit)
2. JRE(Java Environment Kit)
3. JVM(Java Virtual Machine)
4. JDK vs JRE vs JVM
5.Java Portability.
1. JDK(Java Development Kit)
2. JRE(Java Environment Kit)
3. JVM(Java Virtual Machine)
4. JDK vs JRE vs JVM
5.Java Portability.
JDK (Java Development Kit)
Java Development Kit JDK is the main part that contains everything that will be required
to develop and run Java application.As we can see in below diagram that JDK is the
outer part that consist of JRE and JVM. Through it the compiled code goes to JRE.
to develop and run Java application.As we can see in below diagram that JDK is the
outer part that consist of JRE and JVM. Through it the compiled code goes to JRE.
JRE (Java Runtime Environment)
JRE is a part of JDK.Java Runtime Environment contains provides environment to
run Java application which has already been compiled. It doesn’t contain the
code library required to develop Java application.
run Java application which has already been compiled. It doesn’t contain the
code library required to develop Java application.
JVM (Java Virtual Machine)
Java Virtual Machine is a virtual machine which works on top of your operating system
to provide a environment for exceution of your compiled Java code. JVM only works
with bytecode(compile code). Hence you need to compile your Java application(.java)
so that it can be converted to bytecode(compiled) format (also known as the .class file).
to provide a environment for exceution of your compiled Java code. JVM only works
with bytecode(compile code). Hence you need to compile your Java application(.java)
so that it can be converted to bytecode(compiled) format (also known as the .class file).
Which then will be used by JVM to run an application. JVM only provide the
environment needed to executed Java Bytecode.
environment needed to executed Java Bytecode.
JDK vs JRE vs JVM
Lets us see differences between JDK,JRE and JVM with below chart that shows
the various features of each of the Java technologies.
the various features of each of the Java technologies.
Now by observing the diagram we can identify what is the difference.
JRE = Required Library to run Application + JVM .
JDK = Required Library to develop Java Application + JRE.
Java Portability
To understand portability section in Java, firstly we need to understand what happens to java code from start to finish.
- Java Source Code (Written by Developer) (Machine Neutral)
- Compiled Code / Byte Code (Compiled by javac). (Machine Neutral)
- Byte Code executed (Executed by JVM) (Machine Specific)
In step 2, javac (Java Compiler) converts Java code to bytecode(compiled code). This
can be moved to any machine( Linux/Windows/Mac) and executed by JVM. JVM
reads the bytecode and generates machine specific code. In order to generate
machine-specific code, JVM needs to be machine specific. So every type of
Machine(Windows / Mac /Linux) has a specific JVM. So in this way, the coder doesn’t
need to bother with generating bytecode. JVM takes care of portability. So the
conclusion is Java is Portable but JVM is Machine Specific.
can be moved to any machine( Linux/Windows/Mac) and executed by JVM. JVM
reads the bytecode and generates machine specific code. In order to generate
machine-specific code, JVM needs to be machine specific. So every type of
Machine(Windows / Mac /Linux) has a specific JVM. So in this way, the coder doesn’t
need to bother with generating bytecode. JVM takes care of portability. So the
conclusion is Java is Portable but JVM is Machine Specific.
Post a Comment