Java Cross-platform

Source: Internet
Author: User

How is the Java cross-platform implemented? This will refer to the Java Virtual machine (Java VM, or JVM).

We write the Java source code, compiled will generate a. class file, called a bytecode file.

Bytecode cannot be run directly and must be translated into machine code by the JVM to run.

The Java Virtual machine is responsible for translating bytecode files into machine code under a specific platform and then running.

The JVM is also a software that has different versions of different platforms. A bytecode file can be run as long as the corresponding JVM is installed on different platforms.

The same Java program, through the "middle tier" of the JVM, can be run on different platforms, enabling "compile once, run everywhere".

JVM is a "bridge", is a "middleware", is the key to achieve cross-platform, Java code is first compiled into bytecode files, and then by the JVM to translate bytecode files into machine language, so as to achieve the purpose of running Java programs.

Note: The result of compiling is not generating machine code, but generating bytecode, the bytecode generated under different platforms is the same, but the machine code translated by the JVM is not the same.

Java Cross-platform

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.