Java Compiler, Interpreter, Just In Time Compiler

Java Compiler, Interpreter, Just In Time Compiler

Java compiler

Java compiler is a tool to compile the java program . The javac command reads classes and interfaces written in java programming language and then convert into the bytecode or class file. The javac tool can be founded in /bin folder of the JDK installation directory

For example f:\programs>javac AbcDemo.java

Java Interpreter

Java interpreter is used to interpret the .class files that was obtained after compiled the .java file by a Java compiler (javac).
Java interpreter is accessed using java command. The java command is used to run java program or Java application. It does this by starting a Java runtime environment, loading a specified class, and calling that class’s main method. Interpreted means that the computer looks at the language, and then turns it into native machine language.

The Java interpreter is actually a part of JVM. Virtual machine is not just executing the bytecodes, it has lot of tasks to do The method declaration has the following form: 

public static void main(String[] args)

Just In Time Compiler

The just-in-time compiler is the heart of the Java Virtual Machine. The just-in-time (JIT) compilation, can also be refferes as dynamic translation. The compilation done during running a program or execution of a program rather than prior to execution of program

The Just-In-Time (JIT) compiler is a part or component of the JRE. It helps to improves the performance of Java applications by compiling bytecode to the machine on which you run your program ( native machine ) or code at run time. When a Java code is run , JVM launched, that interprets the byte code and provides result. In this process, the role of the JIT is come. It helps a java program to adapt native machine .

for example a char can take 1 byte in linux but it take 2 byte in window.There is also a difference between 32 bit or 64 bit system.

JIT compilation need the time and memory of an OS.The time is also depend on the power and capability of particular Os.