Easy learning with example program codes

jvm (Java Virtual Machine)

What is JVM?

JVM is a virtual machine or a program that provides run-time environment in which java byte code can be executed. JVMs are available for many hardware and software platforms. The use of the same byte code for all JVMs on all platforms make java platform independent.

JVM diagram:


JVM details:

1. Class loader subsystem:

It is a part of JVM that care of finding and loading of class files.

2.  Class/method area:

It is a part of JVM that contains the information of types/classes loaded by class loader. It also contain the static variable, method body etc.

3.  Heap:

It is a part of JVM that contains object. When a new object is created, memory is allocated to the object from the heap and object is no longer referenced memory is reclaimed by garbage collector.

4. Java Stack:

It is a part of JVM that contains local variable, operands and frames. To perform an operation, Byte code instructions takes operands from the stack, operate and then return the result in to the java stack.

5. Program Counter:

For each thread JVM instance provide a separate program counter (PC) or pc register which contains the address of currently executed instruction.

6. Native method stack:

As java program can call native methods (A method written in other language like c).  Native method stack contains these native methods.

7. Execution Engine:

It is a part JVM that uses Virtual processor (for execution), interpreter (for reading instructions) and JIT (Just in time) compiler (for performance improvement) to execute the instructions.

How JVM is created(Why JVM is virtual):    

When JRE installed on your machine, you got all required code to create JVM. JVM is created when you run a java program, e.g. If you create a java program named To compile use – java and to execute use – java FirstJavaProgram. When you run second command – java FirstJavaProgram, JVM is created. That’s why it is virtual.

 Lifetime of JVM:          

When an application starts, a runtime instance is created. When application ends, runtime environment destroyed. If n no. of applications starts on one machine then n no. of runtime instances are created and every application run on its own JVM instance.

Main task of JVM:

  1. Search and locate the required files.
  2. Convert byte code into executable code.
  3. Allocate the memory into ram
  4. Execute the code.
  5. Delete the executable code.

Next Topic: Difference between JVM, JRE and JDK.
Previous Topic: Java features

Related Topics:  

Programming language overview.
Overview of Java.
Java features
JVM (java virtual machine) architecture details.
Difference between JVM, JRE and JDK.
Java Coding Guidelines.


Core Java Tutorial

Programming language overview.
Overview of Java.
Java features
JVM architecture details.
Java Coding Guidelines.
Some important definitions.
Variable and data types.
Hello world java program.
Core java examples programs.
Important Java Programs.
How to set permanent path in java?
OOPs Basics.
Object and Class in Java.
OOPs Principles/Concepts.
Abstraction in java.
Encapsulation in java.
Polymorphism in java.
Method overloading in java.
Method overriding in java.
Dynamic method dispatch.
Runtime polymorphism.
Association in java.
Inheritance in java.
Aggregation in java.
Command line arguments in java.
Command line argument program in eclipse.
Read input from command line using Scanner.
Java array programs
Java star pattern programs
Java number pattern programs
final in java.
Abstract class in java.
Interface in java.
Custom marker Interface in java.
Constructor in java.
Package in java.
Access modifier in java.
Static import in java.
Package class in java.
this in java.
Instance initialize block.
Anonymous block.
super in java.
Static in java.
final in java.
Java cloning deep and shallow
Shallow vs Clone copy
String handling in java.
String handling programs.
StringBuffer in java.
StringBuilder in java.
Exception Handling Tutorial.
Multithreading Tutoial.
Java input output stream tutorial.
Collections framework in java tutorial.
Collections framework programs.
Java Random class
Java annotations.
Java design principles.
Java 7 features
Java 8 features
Java networking tutorial
Java Reflection tutorial

Industrial Training

We offers Placement Oriented Training on Java, Spring, JSF, Hibernate, PHP, AngularJS, Angular 4, PLSQL, Oracle BI Publisher etc. We also provides Online training, please mail us at


We also provides the Development services for Website Development , Java Development, PHP Development, Android App Development etc. You can contact us on

Copyright © 2019 CodesJava Protection Status SiteMap Reference: Java Wiki