728x90 AdSpace

Sunday, 1 October 2017

Introduction to Java Virtual Machine (JVM)

What is JVM

A Java virtual machine (JVM) is an abstract computing machine that enables a computer to run a Java program.

There are three notions of the JVM:
1. Specification
2. Implementation
3. Instance.
The specification is a document that formally describes what is required of a JVM implementation. Having a single specification ensures all implementations are inter-operable. A JVM implementation is a computer program that meets the requirements of the JVM specification. 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)

Java Runtime Environment (JRE) is a software package that contains what is required to run a Java program. It includes a Java Virtual Machine implementation together with an implementation of the Java Class Library. The Oracle Corporation, which owns the Java trademark, distributes a Java Runtime environment with their Java Virtual Machine called HotSpot.

Java Development Kit (JDK)

Java Development Kit (JDK) is a superset of a JRE and contains tools for Java programmers, e.g. a javac compiler. The Java Development Kit is provided free of charge either by Oracle Corporation directly, or by the OpenJDK open source project, which is governed by Oracle.

What JVM does

The JVM performs following operation:

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

JVM provides definitions for the:

  • Memory area
  • Class file format
  • Register set
  • Garbage-collected heap
  • Fatal error reporting etc.

Java Virtual Machine Architecture

1. Classloader : Classloader is a subsystem of JVM that is used to load class files.

2. Class(Method) Area : Class(Method) Area stores per-class structures such as the runtime constant pool, field and method data, the code for methods.

3. Heap : It is the runtime data area in which objects are allocated.

4. Stack : Java Stack stores frames.It holds local variables and partial results, and plays a part in method invocation and return.
Each thread has a private JVM stack, created at the same time as thread. A new frame is created each time a method is invoked. A frame is destroyed when its method invocation completes.

5. Program Counter Register : PC (program counter) register. It contains the address of the Java virtual machine instruction currently being executed.

6. Native Method Stack : It contains all the native methods used in the application.

7. Execution Engine : It contains:
  1. A virtual processor
  2. Interpreter: Read bytecode stream then execute the instructions.
  3. Just-In-Time(JIT) compiler
Annamalai Thangaraj

Annamalai is working as Technical Lead in Leading Telecom company with 5+ years experience in Identity and Access Management , Telecom and Networks, BigData, Java, Spring, Struts, Hibernate, AngularJS, and Enterprise Web Application Development.

Website: Java Tutorials Corner

Shop and help us

Flipkart Offer Snapdeal offer Amazon.in offer Amazon.com offer
  • Blogger Comments
  • Facebook Comments
  • Disqus Comments


  1. I am glad that part of this java tutorials corner. Educating free on java programming to the beginners is excellent.
    Thank you

  2. Really a needy course for All computer aspirants.A great initiative. Thank you sir.


Item Reviewed: Introduction to Java Virtual Machine (JVM) Rating: 5 Reviewed By: Annamalai Thangaraj