What is JVM, JRE, JDK and JIT
Most of the beginners find it difficult to understand the difference between these jargons. In short,
- Java Virtual Machine (JVM) is an abstract definition of a computing machine.
- Java Runtime Environment (JRE) is the implementation of the JVM.
- Java Development Kit (JDK) is a set of tools using which Java programs can be developed and compiled.
- Just In Time Compiler (JIT) runs on the fly in the execution environment to make optimizations on the program.
Java Virtual Machine (JVM)
JVM is an abstract computing machine used to implement Java language. JVM is the key component in the Java eco system. Java's important property is platform independence and to achieve that the role of JVM is critical. The JVM sits on top of the hardware and is used to execute the Java programs. Input for the JVM is Java byte code and it interprets the instructions in the byte code thus executing the programs.
Java Runtime Environment (JRE)
JRE is the software environment where the compiled Java byte codes executes. JRE is the implementation of JVM it includes the code required for running the programs and native code. It contains the implementation of Java interpreter, garbage collector, class loader, java class libraries and related files. You can download the JRE separately or as a bundle along with JDK from Oracle's website.
Java Development Kit (JDK)
Java JDK is the software bundle using which the Java applications can be developed. JDK's main component is the Java compiler using which the Java source code is compiled to byte code. Along with the Java compiler it contains more tools like Jar, JConsole, Javaw, etc. These help tools help in various different aspects of developing a Java application. The JDK bundle can be downloaded from the above given link in Oracle's website.
Just-in Time Compiler (JIT)
JIT compiler is a component that is part of the JVM and hence its implementation JRE. JIT runs when the Java program is interpreted and its objective is to optimize the Java program and make it efficient in terms of performance.