What Is JVM
What Is JVM
When you run the Java program, Java compiler first compiles your Java
code to bytecode. Then, the JVM translates bytecode into native machine
code (set of instructions that a computer's CPU executes directly).
What is JRE?
JRE (Java Runtime Environment) is a software package that provides Java
class libraries, Java Virtual Machine (JVM), and other components that are
required to run Java applications.
What is JDK?
JDK (Java Development Kit) is a software development kit required to
develop applications in Java. When you download JDK, JRE is also
downloaded with it.
1. ClassLoader Subsystem
2. Runtime Data Area
3. Execution Engine
1. ClassLoader Subsystem
Java's dynamic class loading functionality is handled by the ClassLoader
subsystem. It loads, links. and initializes the class file when it refers to a
class for the first time at runtime, not compile time.
1.1 Loading
Classes will be loaded by this component. BootStrap ClassLoader,
Extension ClassLoader, and Application ClassLoader are the three
ClassLoaders that will help in achieving it.
1.2 Linking
1.3 Initialization
This is the final phase of ClassLoading; here, all static variables will be
assigned with the original values, and the static block will be executed.
2. Runtime Data Area
The Runtime Data Area is divided into five major components:
3. Execution Engine
The bytecode, which is assigned to the Runtime Data Area, will be
executed by the Execution Engine. The Execution Engine reads the
bytecode and executes it piece by piece.
Java Native Interface (JNI): JNI will be interacting with the Native
Method Libraries and provides the Native Libraries required for the
Execution Engine.
Native Method Libraries: This is a collection of the Native Libraries,
which is required for the Execution Engine.