JVM (Java Virtual Machine)
JVM is an acronym for “Java Virtual Machine”.
It is a heart of Java programming because it is responsible for converting Byte Code into Machine specific code. Therefore we require different JVM for different systems. For example, Windows has its own JVM, Linux has its own JVM, MAC has its own JVM, etc.
Therefore JVM is a platform dependent. But it makes Java, the platform independent. Therefore we can write Java program once on any system & run on any system (Write Once Run Anywhere) as shown below:
JVM is an important part of JRE (Java Runtime Environment).
JVM Loads & Runs the Java program.
It is called virtual because it is a software simulation that does not has any physical existence.
JRE (Java Runtime Environment)
JRE is a combination of JVM, Java packages, Runtime libraries and other files.
JVM runs the program using a set of files provided in JRE.
If we only need to execute/run any Java program, we should install JRE on our system. Therefore only JRE is not sufficient for Java Developer.
JDK (Java Development Kit)
JDK is a combination of JRE and Java Development Tools.
It is compulsory for Java Developer because it contains tools that are useful for Java Development.
It helps in compiling and debugging of Java program.
Without JDK we can’t write a Java Program.
JIT (Just In Time Compiler)
Just In Time (JIT) compiler is mainly used for achieving high performance of Java programs while running.
Initially, Java was using a straightforward approach in JVM for converting BYTECODE into machine language and then running it on a computer.
JVM used to convert line by line BYTECODE into machine language and run it.
Even if the same BYTECODE is present at different lines, JVM used to convert these BYTECODE lines into machine language every time they appear. That is JVM was doing the same work, again and again, resulting in wastage of time.
After introducing JIT compiler in Java, JVM checks the code initially to find out whether same BYTECODE appears repeatedly. If yes, JVM converts that BYTECODE into machine language only once and use the same converted machine code where ever the same BYTECODE appears.
This approach helps Java in saving time by doing the same type of work only once and using its result where ever it needs.