JDK v/s JRE v/s JVM

These JDK,JRE,JVM are most commonly heard in the Java programming language.

Many people get confused with these 3 terms or they think that they are one and the same, unfortunately they are not synonyms,each one has got its own responsibility.

Let’s see below in detail about what is JVM,JRE and JDK

JDK_JRE_JVM

JVM

It stands for Java Virtual Machine

JVM is responsible for converting byte code into machine specific code because of which we have different JVM for different Operating system, like different JVM for Windows, Linux or Solaris.

But all the JVMs understand the byte code given to it no matter from which machine the byte code got created. This makes Java platform independent.

JVM also provides several paramount features including Memory Management, Garbage Collection, Security etc..

we can Customize the JVM by using Java options.

We can allocate maximum and minimum memory for Heap residing in JVM.

JVM is Virtual because it does not exist physically, we can’t install JVM as it comes with JRE.

JRE

It stands for Java Runtime Environment

It is the implementation of JVM, it physically exists, and hence we can install JRE.

It provides the platform to execute/run the java programs.

It consists of JVM and other libraries like rt.jar which are required to execute the Java program.

We can run any Java program using JRE but we can’t compile the java code using JRE as it does not contain any compiler, debugger etc..

We can see JRE installed in many places like Broswers,TV,Mobile,set-top boxes and most of the electronic gadgets.

JRE in these places uses the JVM and executes the byte code provides in the form of JAR.

JDK

It stands for Java Development Kit and it physically exist and we can install it.

It contains JRE + Development tools like compiler, debugger etc.

Since it contains JRE along with compiler, we can write java code and compile the java code.

Similar to JRE, JDK is also platform specific, we need to use separate JDK for different Operating system like Windows, Linux etc.

All the libraries like Java,Javac etc exist inside the bin folder of JDK installed path.

Difference between JDK, JRE and JVM


JDK is a super set of JRE which contains the JRE along with compiler , hence it can be used for development purposes.

JRE contains JVM and other run time libraries required to execute the program.

It does not contain other development tools like compiler,debugger etc.

Hence we can install JRE only to run the Java applications not to develop them.

JVM cannot be installed as it does not have any physical existence.

It comes with JRE and JDK installation.

It provides platform independence by converting the bytecode obtained from any machine into corresponding machine instructions but it is created only when we execute the java program.

JIT Compiler

It stands for Just In Time Compiler, it was introduced to improve the performance of Java Virtual machine.

As we know JVM converts the bytes code into machine instructions, JIT helps to improve this operation by converting similar byte codes into machine instruction at the same time.

Hence it reduces the overall execution time of program.

JIT is also a part of JVM.

About the Author

Founder of javainsimpleway.com
I love Java and open source technologies and very much passionate about software development.
I like to share my knowledge with others especially on technology 🙂
I have given all the examples as simple as possible to understand for the beginners.
All the code posted on my blog is developed,compiled and tested in my development environment.
If you find any mistakes or bugs, Please drop an email to kb.knowledge.sharing@gmail.com

Connect with me on Facebook for more updates

Share this article on