Monday 29 June 2015

Java Virtual Machine Concepts

When a Java program is compiled it is converted to byte code which is then executed by the Java interpreter by translating the byte code into machine instructions.

Java interpreter is part of Java runtime environment. Byte code is an intermediate code independent of any machine and any operating system. Program in Java run time environment, which is used to interpret byte code, is called Java Virtual Machine (JVM). A Java Virtual Machine is an abstract computing machine. The Java compiler reads Java language source files, translates the source into Java byte codes, and places the byte codes into class files.

Any machine for which Java interpreter is available can execute this byte code. That’s why Java is called Machine independent and Architecture neutral. Figure shows that Java compiler is accepting a Java program and producing its byte code. This byte code can be executed on any operating system (Window-98, Macintosh, Linux etc.) running on any machine with suitable Java interpreter of that machine.

 
The JVM plays the main role to making Java portable. It provides a layer of abstraction between the compiled Java program and the hardware platform and operating system. The JVM is central to Java’s portability because compiled Java programs run on the JVM, independent of whatever hardware is used.

No comments:

Post a Comment