>
What is JVM? What are Bytecodes (Java’s Magic):
- JVM is an abbreviation for Java Virtual Machine, which is a set of tools used to execute Java programs. JVM serves as the intermediary between your program and the host computer.
- Running a java program is a two-step process:
- With the compiler, first you translate a program into an intermediate language called Java bytecodes—the platform-independent codes interpreted by the interpreter on the Java platform.
- The interpreter parses and runs each Java bytecode instruction on the computer. Compilation happens just once; interpretation occurs each time the program is executed.
- Bytecode is a highly optimized set of instructions designed to be executed by the Java run-time system, which is called the Java Virtual Machine (JVM). That is, in its standard form, the JVM is an interpreter for bytecode. Java bytecodes are the machine code instructions for the Java Virtual Machine to interpret.
- Java bytecodes help make "write once, run anywhere" (WORA) possible. The program can be compiled into bytecodes on any platform that has a Java compiler. The bytecodes can then be run on any implementation of the Java VM. Bytecodes are the .class files generated after compilation, which provides actual flow for the program. That means that as long as a computer has a Java VM, the same program written in the Java programming language can run on Windows 2000, a Solaris workstation, or on an iMac, as shown in figure below: Translating a Java program into bytecode helps makes it much easier to run a program in a wide variety of environments. The reason is straightforward: only the JVM needs to be implemented for each platform. Once the run-time package exists for a given system, any Java program can run on it.
Comments
Post a Comment