by Dinesh Thakur

Java is both compiled and an interpreted lang. First the java compiler translates source code into the byte code instructions. In the next stage the java interpreter converts the byte code instructions to machine code.


That can be directly executed by the machine running the java prg. The intermediate code namely the bytecode produced by the java compiler is for a machine that exists only on the memory of a computer.

This machine or the ‘Simuloated computer within the computer’ is known as the “Java Virtual Machine” or JVM.

The JVM can be thought as a mini operating system that forms a layer of abstraction where the underlying hardware. The operating system and the compiled code is concerned the compiler converts the source code into a code that is based on the imaginary computer instructions set. The compiled code is not processor specific.

The interpreter converts these instructions for the underlying hardware to which the interpreter is targeted. The portability feature of the .class file helps in the execution of the prg on any computer with the java virtual machine. This helps in implementing the “write once and run any where” feature of java.

Lifetime of a JVM

The runtime instance of the java virtual machine has a clear mission in life. To run one java application. When a java application starts a run time instance is ban when the application completes the instance dies. If you start three java applications at the same time on the same computer using the same can create and implementation.

You will get three JVM instances. Each java application runs inside its own java virtual machine. 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.