JVM part 1 — What is JVM?

Nimesh Mendis
3 min readMay 30, 2022

--

Hello everyone,

JVM, simply stands for Java Virtual Machine. After searching the phrase called “What is JVM” on Google search engine and found top 5 websites how they define JVM.

1. “JVM (Java Virtual Machine) is an abstract machine. It is a specification that provides runtime environment in which java bytecode can be executed.”(Source: Java Point).

Also, Java Point mentioning that, A specification where working of Java Virtual Machine is specified. But implementation provider is independent to choose the algorithm. Its implementation has been provided by Oracle and other companies. An implementation Its implementation is known as JRE (Java Runtime Environment). Runtime Instance Whenever you write java command on the command prompt to run the java class, an instance of JVM is created.

2. “A Java virtual machine (JVM) is a virtual machine that enables a computer to run Java programs as well as programs written in other languages that are also compiled to Java bytecode. The JVM is detailed by a specification that formally describes what is required in a JVM implementation.” (Source: Wikipedia).

3. “JVM(Java Virtual Machine) acts as a run-time engine to run Java applications. JVM is the one that actually calls the main method present in a java code. JVM is a part of JRE(Java Runtime Environment).” (Source: geeksforgeeks.org).

4. “Java Virtual Machine (JVM) is a engine that provides runtime environment to drive the Java Code or applications. It converts Java bytecode into machines language. JVM is a part of Java Runtime Environment (JRE). In other programming languages, the compiler produces machine code for a particular system.” (Source: Guru99).

5. “The Java Virtual Machine is called JVM, is an abstract computing machine or virtual machine interface that drives the java code.” (Source: W3 School).

Also W3 School mentioned that, Mostly in other Programming Languages, compiler produce code for a particular system but Java compiler produce Bytecode for a Java Virtual Machine.

All the websites mentioning that converting Java bytecode into the machine language, which is not wrong but also it is not the complete job role of JVM.

Before JVM we have to understand what is a “Virtual Machine”, A Virtual Machine (VM) is a compute resource that uses software instead of a physical computer to run programs and deploy apps. One or more virtual “guest” machines run on a physical “host” machine. We can see that the Virtual Machine is not real, it is virtual. When we talk about JVM (Java Virtual Machine), it is something that do not exist. Even though you install or uninstall JDK and JRE, we can’t install or uninstall JVM because its a program to execute virtually.

There are two types of Virtual Machines:

  1. System based Virtual Machine (SVM) — Basically it means that one or more hardware create a environment to work for multiple users or multiple instances. So these environments are completely independent. Examples: Xen, VMware, Hypervisor.
  2. Application based Virtual Machine (AVM) — In here we don’t have any hardware involved. But we may have an application or a software which help us to create a platform to run other programs. Examples: JVM, CLR(Common Language Runtime) for .net, PVM (Parallel Virtual Machine) for perl light weight environment for dynamic language.

JVM is a completely specification, it says how this should be done. When you download JRE, JVM also comes with JRE. After installing JRE on a particular OS automatically it will deploy the code which is required to create a JVM on a OS.

Even though Java is platform independent, but JRE tightly platform dependent. When we executing java program JRE creates JVM instance and JVM take care of converting Java byte code into machine code.

reference — YouTubehttps://youtu.be/bUtIIWbaFKc

--

--