What is JDK, JVM and JRE ?
In the world of java everything starts from this one word "The JDK". The power of java platform can be easily explained by the fact that almost 3 billion devices run on java platform. Java has been around for a very long time now and is virtually into everything from computers to ovens which explains why it is the first choice for a developer and also the fact that it has such a huge community support.
Every beginner that aspires to learn java development goes through the very first step of "Installing the Java Development Kit (JDK)".
This brings us to our very first questions "What is JDK ? "
1 . JAVA DEVELOPMENT KIT (JDK)
The java development kit as it says is a "kit". pretty lame han! 😑
Yes, it is a set of utilities and components that can be used to perform java development.It has all the tools and libraries one would require to develop,test and execute java programs.
Jdk bundles tons of useful stuff and the the most important part is "The runtime environment"(we will come to that later though)
It has utilities ranging from compiler to applet tools. Every java based program or application requires you to install a JDK to function in first place. All you need is to set up a class path to the bin directory of the jdk so that other programs could reference the location of the jdk utilities.
There have been many jdk implementations around from different organizations such as the most popular one called the Oracle JDK or the one on linux called OpenJDK etc. They are pretty much the same and provide set of components which are good enough to run java programs.
If you want to read more about JDK click here.
Now the main catch here is JDK contains an implementation of JVM .
And here comes our next question : "What is a JVM ?"
2 . Java Virtual Machine (JVM)
The Java Virtual Machine is a "specification". Yes you read it correct. There is nothing like JVM as a program that exists physically in form of code. It is an abstract concept and a specification that describes the design of a machine that could run java programs. It is not a physical entity like a software program on a computer.
The main takeaway here is that java virtual machine is just a specification that tells how to write a software program that could run java programs on a computer. It is written by a community of developers that specify the details about the design of the runtime environment.The vendors can then look into this specification and develop an implementation in the form of code that can run on an actual computer.
Now you must be thinking if JVM is just a specification and not a program then what actually runs a java code on a computer ?
Yes you guessed it right! the JRE
3 . Java Runtime Environment (JRE)
Jre is the program that is bundled with the java development kit and is the one that provides a runtime environment for the java code (byte code).
The JRE can be defined as an implementation of a JVM and exists physically on a system. It is a software program that follows the entire JVM specification and additionally provides the java libraries.Oracle currently holds the java trademark and provides the java runtime environment with the name HotSpot.
Conclusion
So guys summarizing everything. The jdk is the set of tools that you require on your computer to begin java development.
This package contains all the utilities and libraries along with the runtime environment. The jvm defines the specifications of this runtime environment on terms of what should be the design and functionalities of the system to run java byte code and finally the jre is the implementation of the jvm specification that is present in the jdk and runs the java byte code.
Hope now you know the difference between the three basic terms about java. So the next you see someone describing jvm and jre as same thing. You can explain them better.😄
Cheers
No comments:
Post a Comment