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

How to install Java

Feature of Java programming language

Flavour and versions of Java Programming language

History of Java

Download and  install  Java

Hollow world program in Java

Data type and variable in 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

How to find reverse number using method in Java

How to find reverse number using method In this article, we will discuss the concept…

22 hours ago

C# inverted full pyramid star pattern

C# inverted full pyramid star pattern In this article, we will discuss the concept of…

3 weeks ago

C# Full Pyramid star pattern program

C# Full Pyramid star pattern program In this article, we will discuss the concept of…

1 month ago

Program to count vowels,consonants,words, characters and space in Java

Program to count vowels, consonants, words, characters and space in Java In this article, we…

1 month ago

How to print multiplication table using Array in C++ language

How to print multiplication table using Array in C++ language In this post, we will…

1 month ago

C Program to multiplication table using Array

C Program to multiplication table using Array In this tutorial , we will discuss about…

2 months ago