We all ask questions when we are learning something. The good programmers never accept things directly, they always ask questions and understand deeply how the system exactly works. It always gives you more confidence if you know the internal working of the system and understands each and every part of the code.
So now when I started learning java, the first thing I downloaded was JDK. In the fraction of second, my mind asked me that, “Bro did you know what is JDK?” and that was the second when this journey was started. Let’s take a look at what is JDK, JRE, and JVM, and how they work?
It simply helps to execute programs on your device. JVM simply provides an environment to run the programs.
Below are four main tasks of JVM:
- Loads the code.
- Verifies the code.
- Executes the code.
- Provides runtime environment.
Without JVM you cannot run the JVM based programs.
JVM is platform dependent. That means we have different JVM configuration for each software and hardware platform. That means the JVM which is run on macOS will not run on windows, for windows you have to download the windows version of the JVM.
Whenever we try to run the code, JVM requires some library set and files for code execution and these files are presented in JRE.
JRE = JVM + set of libraries.
So to run the JVM based programs, the JRE is a minimum requirement.
JRE is also platform dependent. That means we have different JRE versions for different platforms.
It is a full-featured development kit. JDK has each and every development tool that you may require for creating powerful java programs.
JDK = JRE + Development tools.
JDK contains the following tools:
- Java Runtime Environment (JRE).
- Compiler (javac).
- Archiver (jar).
- Documentation generator (javadoc).
- Some other necessary tools.
So in short, if you just want to run the java or JVM based code then JRE is required. But if you want to develop the java or JVM based programs then JDK is required.
So, guys, this was all about JVM, JRE, and JDK. Please let me know in the comments if I missed something.
Please check every day for new posts on Kotlin and other programming topics. Till then Keep Coding, Keep Loving.