I've had a hard time while understanding the difference between JVM(Java virtual machine), JRE (Java Runtime Environment), JDK (Java Development Kit), JIT (Just In Time Compiler), and javac (Java compiler).
What is a good comparison and contrast between all of these?
You might have done so much of google to find the answer of this question and came across a very boring diagram showing the architecture and interrelation between JVM, JRE and JVM. It took me almost a year to understand it practically (not theoretically).
Let’s find out the answer of this simple (but yet very important) question:
What is JDK, JRE and JVM?
JDK:- Java Development Kit (in short JDK) is Kit which provides the environment to Develop and execute(run ) the Java program. For eg. You(as Java Developer) are developing an accounting application on your machine, so what do you going to need into your machine to develop and run this desktop app? You are going to need J-D-K for that purpose for this you just need to go to official website of sun or oracle to download the latest version of JDK into your machine.
Hence, JDK is a kit(or package) which includes two things i) Development Tools(to provide an environment to develop your java programs) and ii) JRE (to execute your java program). JDK is only used by Java Developers.
JRE :- Java Runtime Environment (to say JRE) is an installation package which provides environment to only run(not develop) the java program(or application)onto your machine. For eg(continuing with the same example) after developing your accounting application , you want to run this application into your client’s machine . Now in this case your client only need to run your application into his/her machine so your client should install JRE in-order to run your application into his machine.
Hence, JRE is only used by them who only wants to run the Java Programs i.e. end users of your system.
JVM :- Java Virtual machine(JVM) is a very important part of both JDK and JRE because it is contained or inbuilt in both. Whatever java program you run using JRE or JDK goes into JVM and JVM is responsible to execute the java program line by line hence it is also known as interpreter(we will discuss about interpreter later) . Hence you don’t need to install JVM separately into your machine because it is inbuilt into your JDK or JRE installation package. We’ll explore more about JVM soon.
Finally after learning about all the three main parts of java you can have a look at the above figure to have clear understanding of the architecture and interrelationship between all the main components of java.
Well, I want to tell you my understanding about it.
JDK (Java Developer's Kit) is a complete Java development platform. We can compile, debug and run the code. The JDK depends on the operating system, so there are a little version classify by Windows, Linux and Mac.
JRE(Java Runtime Environment) is the runtime environment of Java. If you had ever played any game which written in Java, you can find that you must have JRE when you is going to play the game. This is the Java Runtime Environment.
JVM (Java Virtual Machine) is a part of JRE. It is the most important part of the JRE.
JIT is the tool which can transform bytecode to the binary code.
javac is the tool which can transform code to the Java bytecode.
We can conclude the relationship:
JDK = JRE + javac + jconsole +jvisualvm + demo + document + other
JRE = JVM + JAVA binary code + other library + other
JVM = JIT + Other
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With