Java Virtual Machine(JVM)

Kasuni Piyumali Waththage
2 min readJul 16, 2022

First of all, Let’s see What is Virtual Machine?

Virtual : Not is a really.

Machine : Device which help to do your work.

Virtual + Machine = Virtual Machine

Virtual Machine : It is a machine which not a real one.

Two types of virtual machines

What is Java Virtual Machine?

The JVM comes with a Java Runtime Environment (JRE) that is tightly coupled with the platform. When you download the JRE for a particular platform, it will also deploy the code needed to create JVM instances for that platform. When we execute a Java program, a JVM instance is being created which converts the bytecode into machine code. These JVM instances exist until we execute the program.

Java is a high level programming language. A program written in a high level language cannot be run directly on the machine. First we need to convert it to machine language. In the Java language, the javac compiler does this for us. It converts the java program (.java file containing source code) into machine code. (to byte code or .class file).

Java Virtual Machine (JVM) is a virtual machine. This works inside the real machine (your computer). Byte code is the machine language that JVM runs on. The JVM executes the byte code prepared by the compiler. The JVM is what gives Java programs platform independence. (Which means that the byte code generated on Windows can be run on Mac OS)

In the next post, we will see about the Inside Java Virtual Machine.

--

--