Home >Java >javaTutorial >What is the use of java virtual machine
The Java virtual machine has its own complete hardware architecture, such as processor, stack, registers, etc., and also has a corresponding instruction system. The Java virtual machine shields the information related to the specific operating system platform, so that the Java program only needs to generate the target code (bytecode) that runs on the Java virtual machine, and it can run on a variety of platforms without modification.
The Java Virtual Machine (Java Virtual Machine, referred to as JVM) is an abstract computer that runs all Java programs. It is the running environment of the Java language. It is the most attractive version of Java. One of the characteristics of force.
Introduction
Java Virtual Machine (JVM) A specification for computer devices that can be implemented in different ways (software or hardware). Compiling the instruction set for a virtual machine is very similar to compiling the instruction set for a microprocessor. The Java virtual machine includes a set of bytecode instructions, a set of registers, a stack, a garbage collection heap and a storage method field.
The Java Virtual Machine (JVM) is an imaginary computer that can run Java code. As long as the interpreter is ported to a specific computer according to the JVM specification, any compiled Java code can be guaranteed to run on that system.
The Java virtual machine is an imaginary machine that is implemented through software simulation on an actual computer. The Java virtual machine has its own imaginary hardware, such as processors, stacks, registers, etc., and also has corresponding instruction systems.
The Java Virtual Machine Specification defines an abstract -- not an actual -- machine or processor. This specification describes an instruction set, a set of registers, a stack, a "garbage heap", and a method area. Once a Java virtual machine is running on a given platform, any Java program (compiled program, called bytecode) can run on that platform. The Java Virtual Machine (JVM) can interpret the bytecode one instruction at a time (mapping it to actual processor instructions), or the bytecode can be compiled by what is called just-in-time on the actual processor. The processor performs further compilation
Features
A very important feature of the Java language is its independence from the platform. The use of Java virtual machine is the key to achieving this feature. If a general high-level language wants to run on different platforms, it must at least be compiled into different target codes. After the introduction of the Java language virtual machine, the Java language does not need to be recompiled when running on different platforms. Java language usage model The Java virtual machine shields information related to specific platforms, so that the Java language compiler only needs to generate the target code (bytecode) that runs on the Java virtual machine, and can run on multiple platforms without modification. run. When the Java virtual machine executes bytecode, it interprets the bytecode into machine instructions for execution on the specific platform.
Using the subject
The Java virtual machine is the basis for the underlying implementation of the Java language. This helps to understand some properties of the Java language and also helps to use the Java language. For software personnel who want to implement the Java virtual machine on a specific platform, compiler authors of the Java language, and people who want to use hardware chips to implement the Java virtual machine, they must have a deep understanding of the specifications of the Java virtual machine. In addition, if you want to extend the Java language or compile other languages into Java language bytecode, you also need to have an in-depth understanding of the Java virtual machine.
The above is the detailed content of What is the use of java virtual machine. For more information, please follow other related articles on the PHP Chinese website!