We must understand the terminologies JDK, JRE, and JVM and differences between them before proceeding further to Java.

In this tutorial, you will learn about JDK, JRE, and JVM. Let’s see a brief overview of these terminologies.

What is JVM?

JVM stands for Java Virtual Machine. JVM is in-built in both JRE and JDK.

Java Virtual Machine is an abstract machine that enables your computer to run a Java program.

It is a platform-dependent as it needs different JVM for different OS.

JVM is called a virtual machine because it doesn’t exist physically. JVM is just a program, not a machine.

It is a specification that provides a runtime environment in which Java bytecode can be executed.

When you compile a Java program, the compiler converts the Java code (.java file) into bytecode (.class file).

And, JVM is responsible for taking .class file and converting that .class file in machine code instructions by JIT or interpreter that can be executed further.

JVM also works as an interpreter for your code because it reads the code of .class file line by line and helps to execute further. If there is any error then JVM stops at that moment and doesn’t execute the code further.

The JVM performs the following main tasks:

  • Loads code
  • Verifies code
  • Executes code
  • Provides runtime environment

JVM Architecture:


1. Classloader

Classloader is a subsystem of JVM which is used to load class files.

Whenever we run the java program, it is first loaded by the classloader.

There are three built-in classloaders in Java i.e, Bootstrap Classloader, Extension Classloader, System/Application Classloader.

2. Class(Method) Area

Class(Method) Area stores pre-class structures (runtime constant pool, field and method data).

All the class-level data will be stored here, including static variables. There is only one method area per JVM, and it is a shared resource.

3. Heap Area

It is a runtime system where all the objects and their corresponding instance variables and arrays will be stored here.

There is also one Heap Area per JVM same as class area.

4. JVM Stack

For every thread, a separate runtime stack will be created.

For every method call, one entry will be made in the stack memory which is called Stack Frame.

All local variables will be created in the stack memory. The stack area is thread-safe since it is not a shared resource.

5. PC Registers

PC (program counter) register contains the address of the Java virtual machine instruction currently being executed.

Once the instructions get executed the PC register automatically gets to the next instruction.

6. Native Method stacks

For every thread, a separate native method is created.

It contains all the native methods used in the application.

7. 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.

It contains:

  1. A virtual processor
  2. Interpreter – Interprets the bytecode line by line and then execute it. Its disadvantage is that when one method is called multiple times, every time a new interpretation is required.
  3. JIT Compiler – It is used to improve the performance. And, it overcomes the disadvantage of interpreter because JIT compiles parts of the byte code that have similar functionality at the same time, and hence reduces the amount of time needed for compilation.

8. Native Method Interface

Java Native Interface is a framework which provides an interface to communicate with another application written in other languages like C, C++, etc.

9. Native Method Libraries

This is a collection of the Native Libraries, which is required for the Execution Engine.

What is JRE?

JRE stands for Java Runtime Environment.

JRE is an installation package which provides an environment to only run the java program into your machines.

JRE is used to provide the runtime environment. It is the implementation of JVM and it physically exists.

If you need to run a Java program but, not develop them then, JRE is the only thing you need to install in your system.

JRE contains a set of libraries+ other files including JVM.


What is JDK?

JDK stands for Java Development Kit.

JDK is a software development environment which is used to develop Java applications. It physically exists.

JDK is used by the developers who wants to develop, execute and display the code.

It contains the JRE + development tools (javac, java, etc).

JDK is an implementation of any one of the given below Java Platforms released by Oracle Corporation:

  • Standard Edition Java Platform
  • Enterprise Edition Java Platform
  • Micro Edition Java Platform


JDK= developing + executing +displaying

JRE= executing + displaying

Thank you!

Leave a Reply

Your email address will not be published. Required fields are marked *