JVM (Java Virtual Machine)
Java virtual machine is the interpreter for Bytecode generated from the source code. As stated earlier, the execution of Java program is two steps process.
→ This show in Figure :
1. The source code file is compiled by java compiler and Bytecode is generated if no error is present. Bytecode is .class file.
2.This Bytecode is then interpreted by JVM and the output is generated.
What is JVM?
A Java virtual machine is an abstract computing machine that enables a computer to run a Java program. There are three notions of the JVM: specification, implementation, and instance. The specification is a document that formally describes what is required of a JVM implementation.
What is Java virtual machine and how it works?
An instance of a JVM is an implementation running in a process that executes a computer program compiled into Java bytecode. Java Runtime Environment (JRE) is a software package that contains what is required to run a Java program.
Java Runtime Environment (JRE):-
→ The Java Runtime Environment (JRE) is a set of software tools for development of Java applications. It combines the Java Virtual Machine (JVM), platform core classes and supporting libraries.
→ JRE is part of the Java Development Kit (JDK) but can be downloaded separately. JRE was originally developed by Sun Microsystems Inc., a wholly-owned subsidiary of Oracle Corporation.
→ It provides the run-time environment.
→ It physically exists.
→ It provides set of library and another file.
Differences between JVM and JRE
The JRE is the environment within which the virtual machine runs. JRE is the container, JVM is the content. Java Runtime Environment contains JVM, class libraries, and other supporting files. It does not contain any development tools such as compiler, debugger, etc.