In this section, you will learn about the java virtual machine (JVM) and how to work?
Java Virtual Machine (JVM)
Java Virtual Machine is a set of computer software programs and data structure that uses the virtual machine model to execute other computer programs and scripts. This model is used by JVM that accepts a form of the source from an computer intermediate language known a java byte code.
It is the principal component of Java architecture that provides the cross platform functionality and security to Java. This is a software process that converts the compiled Java byte code to machine code. Byte code is an intermediary language between Java source and the host system.
Most programming languages like C and Pascal translate the source code into machine code for one specific type of machine as the machine language vary from system to system. So most complier produce code for a particular system but Java compiler produce code for a virtual machine. The translation is done in two steps. First the programs written in Java or the source code translated by Java compiler into byte code and after that the JVM converts the byte code into machine code for the computer who wants to run.
So the program files written in
Java are stored in .java files and these .java files are compiled by the Java
compiler into byte code that are stored in .class file. The JVM later converts it
into machine code. In fact the byte code format is same on all platforms as it
runs in the same JVM and it is totally independent from the operating
system and CPU architecture. JVM is a part of Java Run Time
Environment that is required by every operating system.
JRE consists of a number of classes based on Java
API and JVM and without JRE, it is impossible to run Java. So its
portability really made it possible in developing write once and run anywhere
See the function of JVM
Recommend the tutorial