/Difference between JDK, JRE, JVM and JIT (JDK vs JRE vs JVM vs JIT)

Difference between JDK, JRE, JVM and JIT (JDK vs JRE vs JVM vs JIT)

Compiled on Aug 04 2012 in Java

As we have discussed Advantages & Features of Java. I told you about the concept of Write-once-run-anywhere (known as the Platform independent). Its ability to run & move Java programs easily from one platform to another (same or different) but the platform must have the JVM.

Now the question arises "having JVM installed on your system is enough for Learning Java?"
The answer is NO. JVM is not enough even JRE is not enough. You will need JDK for it. But what are these terms? today I will tell you about JDK, JRE, JVM and JIT. Let's start with JIT

JIT (Just-in-time Compiler)

JIT also known as dynamic translation. JIT is the part of the Java Virtual Machine (JVM) that helps to speed up the execution time. Parts of the byte code that have similar functionality at the same time complied by JIT and saves time needed for compilation. It translates the instruction set of a Java virtual machine (JVM) to the instruction set of a specific CPU.

JVM (Java Virtual Machine)

When we compile a Java file, output is not an .exe but it's a .class file. This .class is known as Java byte code, it has the Java byte codes which can be understood by JVM. Java Virtual Machine interprets the byte code into the machine code and execute it. It is responsible for all the things like garbage collection, array bounds checking, etc… JVM is a cornerstone of the write-once run-anywhere value of Java programs.

JVM is platform dependent but it makes the Java platform independent.

The Java Virtual Machine provides a platform-independent way of executing code; programmers can concentrate on writing software, without having to be concerned with how or where it will run.

JRE (Java Runtime Environment)

Sun’s implementations of the Java virtual machine (JVM) are itself called as JRE. Java Runtime Environment contains JVM with class libraries and other supporting files. Actually, JVM runs the program, and it uses the class libraries, and other supporting files provided in JRE.

If u just want to run applets (ex: Online games or puzzles), JRE needs to be installed on the machine.

You need to have JRE installed in the system if you want to run any java program.

JDK (Java Development Kit)

The JDK is used by developers and contains both the JRE to run the programs and the tools needed to develop and compile the Java programs. JDK includes compiler (javac.exe), Java application launcher (java.exe), Appletviewer, etc… Compiler translates java code into byte code. Java application launcher opens a JRE, loads the class and then JRE does its jobs.

You will need JDK, if at you want to write and compile your own programs. For running java programs, JRE is sufficient.

JRE is targeted for execution of Java files and JDK is targeted for java development (create and compile Java files).

Simple summary: The JDK contains the JRE which contains the JVM.

You can Download Java (JDK, JRE, JVM) from here.

In my next tutorial I'll tell you How to Download and Install JDK and JRE?