JAVA comprises of a few components which we need to know and what they do. So, in this topic, we will learn about JAVA compiler javac, Java Virtual Machine JVM, Java Runtime Environment JRE.
Compilation and Interpretation in JAVA
JAVA combines both the approaches of compilation and interpretation. Firstly, JAVA compiler compiles the source code into bytecode. At the run time, Java Virtual Machine (JVM) interprets this bytecode and generates machine code which is directly executed by the machine in which Java program runs. So Java is both a compiled and an interpreted language.
javac is a compiler which is used to compile java programs on your machine.
JVM is a virtual machine which consists of the class loader, bytecode verifier, Java interpreter, and Runtime system. JVM provides the runtime environment for Java program to run on the computer.
JRE Java Runtime Environment contains JVM, class libraries and other supporting components. It provides proper runtime environment for the Java program to execute in the system.
Here is the architecture of Java.