Core java tutorial for beginners
A tutorial blog which explains different core concepts related to Java along with programming examples

December 25, 2015 Categories: Core Java Basics. No Comments on Java Virtual Machine

In this article we will look at Java Virtual Machine (JVM) which provides the run-time engine for bytecode generated by the Java compiler. We will look at JVM architecture and more.





Before learning about JVM it is important to know about JDK (Java Development Kit) and JRE (Java Runtime Environment). Below figure shows the relationship between JDK, JRE, and JVM:




JDK provides programmers with a set of tools (like javac, debugger, javap, appletviewer etc..) for developing Java programs. JDK includes JRE.


JRE provides the run-time engine JVM along with the class libraries which contains the predefined functionality.


Using JDK programmers can create and run Java programs. But with JRE alone, programmers or users can only run already compiled Java programs. We cannot create Java programs using only JRE.


Java Virtual Machine (JVM) is an abstract computing machine that allows a computer to run programs written in Java. There are three concepts related to JVM:

  • Specification
  • Implementation
  • Instance


The JVM specification is a document which contains formal information about what a JVM implementation should contain. A single specification allows various interoperable implementations.


A JVM implementation is a computer program that meets the requirements given in JVM specification.


An instance of a JVM is an implementation running in a process that executes bytecode. Oracle’s implementation of JVM specification is known as HotSpot. Other famous implementations are JRockit, Kaffe, IBM J9.


Overview of the architecture of JVM is as shown below:




Class Loader


A class loader implementation is a program that should be able to perform the following activities:

  • Loading: finds and imports the binary data for a type
  • Linking: performs verification, preparation, and resolution (optional)
  • Initialization: Invokes Java code that initializes class variables to their proper initial values




The heap area of JVM is used for dynamic memory allocation. In HotSpot the heap is divided into generations:

  • The young generation stores objects whose lifetime is short.
  • The old generation stores objects which persist for longer durations.


The permanent generation area stores class definitions and other metadata. This area is removed in Java 8.


More information about Java Virtual Machine can be found here.

Related Links:

Note: Do you have a question on this article or have a suggestion to make this article better? You can ask or suggest us by filling in the below form. After commenting, your comment will be held for moderation and will be published in 24-48 hrs.

Leave a Reply

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

Scroll Up