Java Virtual Machine
A Java virtual machine’s main job is to load class files and execute the bytecodes they contain.
v Only those class files from the Java API that are actually needed by a running program are loaded into the virtual machine
v The bytecodes are executed in an execution engine, which is one part of the VM (Virtual Machine)
v At the heart of Java’s network orientation is the Java virtual machine, which supports all three prongs of Java’s network oriented architecture: platform independence, security, and network-mobility.
v The Java virtual machine is an abstract computer. Its specification defines certain features every Java virtual machine must have, but leaves many choices to the designers of each implementation.
Ø For example, although all Java virtual machine must be able to execute Java bytecodes, they may use any technique to execute them.
Ø Also the specification is flexible enough to allow a Java virtual machine to be implemented either completely in software or to varying degrees in hardware.
Ø The flexible nature of the Java virtual machine’s specification enables it to be implemented on a wide variety of computers and devices.
v A Java virtual machine’s main job is to load class files and execute the bytecodes they contain. The Java virtual machine contains a class loader, which loads class files from both the program and the Java API.
Ø Only those class files from the Java API that are actually needed by a running program are loaded into the virtual machine.
v The execution engine is one part of the virtual machine that can vary in different implementation.
Ø On a Java virtual machine implemented in software, the simplest kind of execution engine just interprets the bytecodes one at a time.
v Another kind of execution engine, one that is fastest but requires more memory, is a just in time compiler.
Ø In this scheme, the bytecodes of a method are compiled to native machine code the first time the method is invoked.
Ø The native machine code for the method is then cached, so it can be re-used the next time that same method invoked.

Join the conversation! Your thoughts help the community grow.