Operating mechanism and JVM for Java programs

Source: Internet
Author: User

1. The Java language is special, a program written by Java requires a compilation step, but this compilation step does not produce a specific platform machine code, but instead generates a platform-independent bytecode (that is, a . class file ). This bytecode is not executable and must be interpreted using the Java interpreter. Therefore, it can be considered that the Java language is both a compiled language and an interpreted language. In other words, the Java language is neither a purely compiled language nor a purely interpretive language.

the execution of Java programs must be compiled first and then explained in two steps.  2. In the Java language,the Java Virtual machine responsible for interpreting the execution of the bytecode file, which is the JVM (Java Virtual machine). The JVM is a virtual machine that can run Java bytecode files. The JVM on all platforms provides the same programming interface to the compiler, and the compiler only needs to target the virtual machine, generate the code that the virtual machine understands, and then interpret the execution by the VM. In the implementation of some virtual machines, the virtual machine code is also converted to the machine code execution of the specific system, thus improving the operational efficiency. 3. When compiling Java programs using the Java compiler, platform-independent bytecode is generated, and these bytecode are not targeted to any specific platform. Only for the JVM. The JVMs on different platforms are different, but they all provide the same interface. The JVM is a key part of a Java program's cross-platform. As long as the corresponding virtual machines are implemented for different platforms, the compiled Java bytecode can be run on the platform. Obviously, the same bytecode program needs to run on a different platform, which is almost "impossible" and can only be achieved by means of an intermediate converter, the JVM being the converter. 4. The JVM is an abstract computer that, like the actual computer, has instruction sets and uses different storage areas. It is responsible for executing instructions and managing data, memory, and registers. The Java Virtual Machine specification, developed by Oracle, specifies a uniform standard for the JVM, which defines the following details: format stack of instruction set register class file garbage-collected heap storage The purpose of these specifications set by Oracle is to provide a uniform standard and ultimately It realizes the platform independence of Java program.

Operating mechanism and JVM for Java programs

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.