Revisiting the JVM                                                        

When you run java.exe, you are actually firing up a Java Virtual Machine. The JVM is the tool that makes
Java platform independent. Every operating system you use has its own version of the JVM. The JVM is
actually a sophisticated piece of software.

























The JVM uses its class loader to locate bytecodes. These bytecodes are loaded at runtime. The bytecodes can
be changed while the program is running. Bytecodes are stored in a separate namespace to ensure that they
don’t spoof, or replace, existing Java API bytecodes. The class loader looks for bytecodes using the
classpath. The classpath is a list of folders to search for .class files. By default, the classpath is set to the
current directory. This is how the JVM was able to find HelloWorld.class in the example above.

The JVM uses the bytecode verifier to security check the loaded bytecode. The verifier makes sure the code
is Java and adheres to the Java specification. The verifier checks for illegal data conversions and checks all
types. The verifier protects from stack overflows and memory allocation problems.

After the code is loaded and verified, it gets converted (interpreted) into machine code. Because the hardware-
dependent JVM, rather than the compiler, is responsible for the conversion, the same bytecode can be
delivered to just about any machine. The class files are written in platform- and OS-neutral
JVM
Table of Contents
Copyright (c) 2008.  Intertech, Inc. All Rights Reserved.  This information is to be used exclusively as an
online learning aid.  Any attempts to copy, reproduce, or use for training is strictly prohibited.
Courseware
Training Resources
Tutorials
Services