JVM (Java Virtual Machine) Architecture | Explained

JVM is an abstract machine that is used to execute Java programs. In Java, the source code is converted into bytecode which after being further converted to a machine code is transferred to memory by the Java Virtual Machine. In short, JVM provides a runtime environment for the execution of Java bytecode which makes it a component of Java Runtime Environment (JRE). Overall, a JVM is responsible for loading, linking, and initialization.

JVM Architecture

The internal architecture of Java Virtual Machine consists of three main parts.

1. ClassLoader

2. Memory Area

3. Execution Engine

Here is a visual representation of JVM architecture.

Below all parts of Java Virtual Machine are explained in detail.

1. ClassLoader

A classloader in JVM refers to a subsystem that is responsible for loading files. It loads a java program every time we run a java program. Java provides the following classloaders.

a. Bootstrap ClassLoader

A superclass of Extension ClassLoader that is responsible for loading the rt.jar file

b. Extension ClassLoader

A child of Bootstrap Classloader and parent of System/Application ClassLoader, extension classloader loads jar files that are saved in the directory.

c. System/Application ClassLoader

This class loader loads class files from the classpath and is a child of Extension ClassLoader.

2. Memory Area

A JVM memory area consists of the following parts.

a. Method Area

The purpose of the method area is to save the structure of classes such as method data or field data, runtime pool, and code for methods.

b. Heap

Heap is a runtime data area where objects are allocated.

c. Stacks

Stack is responsible for storing frames, local variables, and partial results. It plays an important role in method invocation and method return. Every time a thread is created, a private JVM stack for that particular thread is created simultaneously and a new frame is created every time a method is invoked, and as soon as the invocation finishes the frame is destroyed.

d. PC Registers

It is responsible for holding the addresses while JVM instructions are being executed.

e. Native Method Stacks

It is responsible for holding all native methods required in an application.

3. Execution Engine

An execution engine consists of the following.

a. Interpreter

It executes instructions after reading the bytecode stream.

b. Just-in-time (JIT) compiler

JIT enhances the performance by compiling parts of bytecode with similar functionalities at the same, henceforth, reducing the overall compilation time.

c.Garbage Collector

It is used to collect objects that are not referenced and remove them to free up the memory.

Native Method Interface

It aids in communicating with applications written in different languages like C, C++, etc. It is also responsible for helping Java code running in JVM to call libraries and native applications.

Method Libraries

It consists of native libraries (C, C++) that are necessary for the Execution Engine.


Java Virtual Machine (JVM) is an abstract machine that is built to execute java programs. The architecture of JVM comprises three main parts which are classloader, memory area, and an execution engine. Memory area and execution engine further consist of some parts that have different functionalities. This tutorial explains the architecture of Java Virtual Machine (JVM) highlighting the functions of its different components.

About the author

Naima Aftab

I am a software engineering professional with a profound interest in writing. I am pursuing technical writing as my full-time career and sharing my knowledge through my words.