0% found this document useful (0 votes)
4 views15 pages

Jre & Jvm Notes

The document provides an overview of Java architecture, detailing its key components including the Java Runtime Environment (JRE), Java Development Kit (JDK), and Java Virtual Machine (JVM). It explains the processes of compilation and interpretation in Java, as well as the functions of the JVM such as loading, verifying, and executing code. Additionally, it covers the architecture of the JVM, including its various subsystems and the garbage collection process.

Uploaded by

Sebin Mathew
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views15 pages

Jre & Jvm Notes

The document provides an overview of Java architecture, detailing its key components including the Java Runtime Environment (JRE), Java Development Kit (JDK), and Java Virtual Machine (JVM). It explains the processes of compilation and interpretation in Java, as well as the functions of the JVM such as loading, verifying, and executing code. Additionally, it covers the architecture of the JVM, including its various subsystems and the garbage collection process.

Uploaded by

Sebin Mathew
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

6/13/25, 7:36 PM Java Architecture and Components.

Understanding of Java Architecture and… | by Devaraj Durairaj | Medium

Open in app Sign up Sign in

Java Architecture
Search and Components
5 min read · Mar 4, 2022

Devaraj Durairaj Follow

Listen Share

Are you Java Programmer? This blog helps you to understand every aspect of this
language. It is a must for the programmer to understand the language. The most
important aspect of Java is its architecture and also understand the components of
Java Virtual Machine(JVM).

What is Java Architecture?


There are two processes in Java — Compilation and Interpretation.

The Java source code goes to the compiler.

The Java Compiler converts it into byte codes

The bytes codes are then converted into machine by the JVM

The Machine code is executed directly by the machine(Operating System)

https://devaraj-durairaj.medium.com/java-architecture-and-components-febd83b3adfc 1/15
6/13/25, 7:36 PM Java Architecture and Components. Understanding of Java Architecture and… | by Devaraj Durairaj | Medium

Java Architecture

Components of Java Architecture


The different components of Java architecture are

JRE — Java Runtime Environment

JDK — Java Development Kit

JVM — Java Virtual Machine

https://devaraj-durairaj.medium.com/java-architecture-and-components-febd83b3adfc 2/15
6/13/25, 7:36 PM Java Architecture and Components. Understanding of Java Architecture and… | by Devaraj Durairaj | Medium

Java Runtime Environment(JRE)


Java Runtime Environment provides an platform where all the applications like JVM
and other runtime libraries linked together to run your Java Program. It builds a
runtime environment where you can execute the Java program. The JRE also
initiates the JVM for its execution. JRE has the required software and libraries to run
the programs.

Java Development Kit (JDK)


Java Development Kit is the set of libraries, compiler, interpreter and other set of
programs that will help you to build the Java program. Once JDK installed on
machine then start developing, compile and run the Java program. You cannot
compile Java program without JDK installed on machine. Once you compile the
code with JDK tools, you can get an Byte Code File.

java : it is the launcher for all the java applications.

javac : compiler of the java programming languages.

javadoc: it is the API documentation generator.


https://devaraj-durairaj.medium.com/java-architecture-and-components-febd83b3adfc 3/15
6/13/25, 7:36 PM Java Architecture and Components. Understanding of Java Architecture and… | by Devaraj Durairaj | Medium

jar: creates and manage all the JAR files.

Java Virtual Machine(JVM)


JVM is the interpreter that executes the byte codes into Machine code(instructions).
The beautiful quality is WORA( Write Once Run Anywhere). This means code can
runs its applications on any platform. This makes Java as Platform Independent.

In a nutshell, JVM performs the following functions:

Loads the code

Verifies the code

Executes the code

Provides runtime environment

The below architecture depicts the architecture of the JVM. Let’s see the each
element in detail:

Components of JVM

Components of JVM
Class Loader Subsystem

https://devaraj-durairaj.medium.com/java-architecture-and-components-febd83b3adfc 4/15
6/13/25, 7:36 PM Java Architecture and Components. Understanding of Java Architecture and… | by Devaraj Durairaj | Medium

Class Loader is a subsystem of the Java Virtual Machine loads class files. It is the
first component of the architecture as it loads the program so other tasks can take
place. It also links and initialize the class files. It has three components — Loading,
Linking and Initialization

Loading — This component loads the class. It has

Bootstrap Classloader — Loads the classes belonging to the bootstrap classpath.


It loads core java API classes present in the “JAVA_HOME/jre/lib” directory

Extension Classloader — Loads classes situated inside the extension


folders“JAVA_HOME/jre/lib/ext”(Extension path)

Application Classloader — Loads classes from path mentioned Environment


Variable (mapped to java.class.path) or similar files It is also implemented in
Java by the sun.misc.Launcher$AppClassLoader class.

Linking — The subsystem has a verifier to verify if the byte code is correct or not. It
generates the verification error if the byte code isn’t proper. The linking allocates all
static variables memory and assigns the default values and replaces the symbolic
references of memory with original ones.

Initialization — The system assigns the static variables to the original ones and
executes the static block.
Runtime Data Areas
Class Method Area -

It stores all the class -level data.

Static Variables, Static Blocks, Static Methods, Instance Methods are stored in
this area.

Every JVM has only one method area.

Heap Area -

A heap is created when the JVM starts up.

It may increase or decrease in size while the application runs.

It stores all the objects and their instance arrays and variables.

https://devaraj-durairaj.medium.com/java-architecture-and-components-febd83b3adfc 5/15
6/13/25, 7:36 PM Java Architecture and Components. Understanding of Java Architecture and… | by Devaraj Durairaj | Medium

Only one heap area per JVM.

Stack Area -

JVM stack is known as a thread stack.

It is a data area in the JVM memory which is created for a single execution
thread.

The JVM stack of a thread is used by the thread to store various elements i.e.;
local variables, partial results, and data for calling method and returns.

It creates unique runtime stacks for every thread and makes an entry for every
method call in the stack memory(knows as stock frame).

It is a Local Variable Array which is related to the method, operand stack and the
frame data, where all symbols related to the method remain stored.

The frame data maintains the catch block information unless there’s an
exception.

PC Registers -

Every thread has separate PC Registers which hold the address of the running
instructions.

Once an instruction has completed execution, the PC register updates itself with
the next one.

Native Method Stacks -

It subsumes all the native methods used in your application.

It creates a unique native method stack for every thread.

Note that method area and heap area are shared resources while the stack area is
not.
Execution Engine
The Execution Engine executes the bytecode. It reads and executes and has different
components:

Interpreter -
https://devaraj-durairaj.medium.com/java-architecture-and-components-febd83b3adfc 6/15
6/13/25, 7:36 PM Java Architecture and Components. Understanding of Java Architecture and… | by Devaraj Durairaj | Medium

Interprets the bytecode quickly but is a little slow in execution

It has a significant drawback as when the system calls one method multiple
times, and it requires a new interpretation every time.

This drawback of the interpreter damages the efficiency of the process


substantially.

JIT Complier -

The Just-In-Time Compiler is part of the runtime environment

It helps in improving the performance of Java applications by compiling byte


codes to machine code at runtime

The JIT Compiler has the intermediate code generator for producing
intermediate code and the code optimizer for optimizing the same.

It also has a target code generator that produces the native doe and a profile that
finds hotspots.

It is enabled by default. The JIT compiler compiles the bytecode of that method
into machine code, compiling it “just in time” to run

The JIT Compiler doesn’t have the drawback the interpreter has.When the
Execution Engine finds repeated code, it uses the JIT Compiler instead of the
interpreter.

Garbage Collector -

Gathers and gets rid of unreferenced objects.

It tracks each and every object available in the JVM heap space and removes
unwanted ones.

Garbage collector works in two simple steps known as Mark and Sweep:

Mark — it is where the garbage collector identifies which piece of memory is in use and
which are not

Sweep — it removes objects identified during the “mark” phase.

https://devaraj-durairaj.medium.com/java-architecture-and-components-febd83b3adfc 7/15
6/13/25, 7:36 PM Java Architecture and Components. Understanding of Java Architecture and… | by Devaraj Durairaj | Medium

Apart from these components the JVM also has the JNI (Java Native Interface) and
the Native Method Libraries.

Java Native Interface (JNI) :


It is an interface that interacts with the Native Method Libraries and provides the
native libraries(C, C++) required for the execution. It enables JVM to call C/C++
libraries and to be called by C/C++ libraries which may be specific to hardware.

Native Method Libraries :


It is a collection of the Native Libraries(C, C++) which are required by the Execution
Engine.

Java Architecture

Follow

Written by Devaraj Durairaj


135 followers · 14 following

Software Architect| Professional Programmer| Data Scientist | Writer

Responses (1)

Write a response

What are your thoughts?

https://devaraj-durairaj.medium.com/java-architecture-and-components-febd83b3adfc 8/15
6/13/25, 7:36 PM Java Architecture and Components. Understanding of Java Architecture and… | by Devaraj Durairaj | Medium

Khanglediv
Jan 5, 2024

symbolic references of memory

Symbolic references in java are used for locating code or data in a jar file

Reply

More from Devaraj Durairaj

Devaraj Durairaj

Garbage Collection — Java Architecture


In the previous blog post, we saw Java Architecture and JVM components. As part of the post,
covered briefly about the Garbage Collector…

Mar 4, 2022 67

https://devaraj-durairaj.medium.com/java-architecture-and-components-febd83b3adfc 9/15
6/13/25, 7:36 PM Java Architecture and Components. Understanding of Java Architecture and… | by Devaraj Durairaj | Medium

Devaraj Durairaj

Competitive Programming & Time Complexity


As Wikipedia says, competitive programming is a mind sport usually held over the Internet or a
local network, involving participants trying…

Oct 6, 2022 3

Devaraj Durairaj

API Architectural Styles


Two separate application/system needs an intermediary to talk to each other and developers
often build bridges — Application Programming…

https://devaraj-durairaj.medium.com/java-architecture-and-components-febd83b3adfc 10/15
6/13/25, 7:36 PM Java Architecture and Components. Understanding of Java Architecture and… | by Devaraj Durairaj | Medium

Sep 21, 2021 296 3

Devaraj Durairaj

Concepts & Characteristics of Software Architecture


Today, every one starting from small children, young people and old people using their smart
phones, laptops, computers, PDA etc.., to…

Mar 19, 2022 9

See all from Devaraj Durairaj

Recommended from Medium

https://devaraj-durairaj.medium.com/java-architecture-and-components-febd83b3adfc 11/15
6/13/25, 7:36 PM Java Architecture and Components. Understanding of Java Architecture and… | by Devaraj Durairaj | Medium

Jayram Manale

Low-Level Design — Unleashing the Power of the Prototype Design


Pattern in Java
Efficient Object Creation Explained with Real-World Examples, Best Practices, and Expert
Insights

Feb 16

GN

Java 21 Advanced Interview Questions: 20 Must-Know Topics for Senior


Developers
https://devaraj-durairaj.medium.com/java-architecture-and-components-febd83b3adfc 12/15
6/13/25, 7:36 PM Java Architecture and Components. Understanding of Java Architecture and… | by Devaraj Durairaj | Medium

Introduction:

Jan 21

Pudari Madhavi

12 Multithreading Java Interview Questions


Break down complex Java multithreading questions into simple, interview-ready answers — no
fluff, just clarity.

Jun 2 25 1

https://devaraj-durairaj.medium.com/java-architecture-and-components-febd83b3adfc 13/15
6/13/25, 7:36 PM Java Architecture and Components. Understanding of Java Architecture and… | by Devaraj Durairaj | Medium

Sanjay Singh

🚀 Top 10 Java Spring Boot Microservices Interview Questions (With


Code & Solutions)
🔍 Introduction

Feb 25 54

Rukmal Senavirathne

Ways to replace if-else statements and switch cases in Java.


Why should we replace if-else and switch cases?

Feb 2

https://devaraj-durairaj.medium.com/java-architecture-and-components-febd83b3adfc 14/15
6/13/25, 7:36 PM Java Architecture and Components. Understanding of Java Architecture and… | by Devaraj Durairaj | Medium

Developersanchit

Why Senior Java Developers Don’t Write if-else Logic Anymore


One of the most expensive things I learned from an older Java developer wasn’t a new
framework, a new tool, or a syntax trick. It was this…

Jun 6 84

See more recommendations

https://devaraj-durairaj.medium.com/java-architecture-and-components-febd83b3adfc 15/15

You might also like