Basic

How does JVM works internally in Java language

How does JVM works internally in Java language

In this tutorial, We will learn about How JVM works internally in Java language.

A program written in a high-level language is known as a source program or source code.

A source program must be translated into machine code for execution as a computer cannot understand a source program.

The computer can only execute the code in binary form.

The translation can be done using another programming tool called an interpreter or compiler.

What is a compiler?

A compiler translates the entire source code into a machine code file or an intermediate code. Then, that file is executed.

works compiler

What is interpreter

An interpreter reads a statement from source code, translates it to the machine code or virtual machine code and then executes it right away.

work on interpreter

How does Java work?

First, we can write a Java program using Java language in a text editor. Java source code will be saved with the extension is – .java  Then, we can use a Java compiler to compile the codes to get the Java bytecode. This Java bytecode can have the .class extension. Java bytecode is the modified version of the Java source code. And then we can pass this Java bytecode to Java virtual machine (JVM) which is an interpreter. It reads one statement at a time from this Java bytecode. Then, it converts that machine level code and executes that code. This is repeated until all codes are executed. Finally, an output is available after the execution of the program.

Execute of same codes in different platforms.

We can execute our code in windows, and also we can execute our code in mac or Linux or other o/s.

how it is possible?

Java contains a special package JVM(Java virtual machine) which executes our Java bytecode. Java provides the specific platform for JVM. If you use windows platform, then you must have windows specific JVM.  If you have used Linux platform, then you must have Linux specific JVM. All these platform-specific JVM are capable of executing the Java bytecode in the same way. So Java program is capable of running on different platforms.

 

Suggested for you

Download and install of Java

History of Java

Features of Java programming language
How to set Java path of various operating system
Karmehavannan

I am Mr S.Karmehavannan. Founder and CEO of this website. This website specially designed for the programming learners and very especially programming beginners, this website will gradually lead the learners to develop their programming skill.

Recent Posts

PHP Star Triangle pattern program

PHP Star Triangle pattern program In this tutorial, we will discuss about PHP Star Triangle…

1 month ago

PHP Full Pyramid pattern program

PHP Full Pyramid pattern program In this tutorial, we will discuss about PHP Full Pyramid…

1 month ago

5 methods to add two numbers in Java

5 methods to add two numbers in Java In this tutorial, we will discuss the…

2 months ago

Python Full Pyramid star pattern program

Python full Pyramid star pattern program In this tutorial, we will discuss  the concept of…

5 months ago

Write a function or method to convert C into F -Entered by user

Write a function or method to convert C into F -Entered by the user In…

9 months ago

How to write a function or method to convert Celsius into Fahrenheit

How to write a function or method to convert Celsius into Fahrenheit In this tutorial,…

9 months ago