Java77: Java Virtual Machine (JVM) Introduction : Java

Translate

Java Virtual Machine (JVM) Introduction

A Java virtual machine (JVM), an implementation of the Java Virtual Machine Specification, interprets compiled Java binary code for a computer's processor so that it can perform a Java program's instructions. Java was designed to allow application programs to be built that could be run on any platform without having to be rewritten or recompiled by the programmer for each separate platform. A Java virtual machine makes this possible because it is aware of the specific instruction lengths and other particularities of the platform.
JVM becomes an instance of JRE at runtime of a java program. It is widely known as a runtime interpreter.

The Java virtual machine (JVM) is the cornerstone on top of which the Java technology is built upon. It is the component of the Java technology responsible for its hardware and platform independence. JVM largely helps in the abstraction of inner implementation from the programmers who make use of libraries for their programmes from JDK.

Life Cycle of JVM :

When a Java application starts, a runtime instance is born. When the application completes, the instance dies. If you start three Java applications at the same time, on the same computer, using the same concrete implementation, you'll get three Java virtual machine instances. Each Java application runs inside its own Java virtual machine.

For Example :

If we have a Node manager which contains 3 Managed server having instance of JVM, then there will be 3 instance of JVM running on managed server, all of them will be pointing to the Node manager.

The source code is first written in plain text files ending with the .java extension. Those source files are then compiled into .class files by the javac compiler. A .class file does not contain code that is native to your processor; it instead contains bytecodes — the machine language of the Java Virtual Machine (Java VM). The java launcher tool then runs your application with an instance of the Java Virtual Machine.

                              jvm-arch


A Java virtual machine instance starts running its solitary application by invoking the main() method of some initial class. The main() method must be public, static, return void, and accept one parameter: a String array. Any class with such a main() method can be used as the starting point for a Java application.


3 comments: