Talking about Java cross-platform

Source: Internet
Author: User

All say that Java is cross-platform, but why is it cross-platform? I'll explain it a little bit.

Programs written in the Java language are compiled first, but this compilation does not generate a specific platform machine code, but rather generates a platform-independent bytecode.

In the Java language, the Java Virtual Machine is responsible for interpreting the execution of bytecode files. The JVM is the virtual machine that runs the bytecode file. The JVM on all platforms provides the same programming interface to the compiler, and the compiler only needs to target the virtual machine to generate the bytecode understood by the virtual machine, which is then interpreted by the virtual machines for execution. The reason for Java cross-platform is that bytecode is platform-independent, but different platforms have different JVMs, but they provide the same interface to the compiler-generated Java bytecode programs, but they adapt to different platforms ' interfaces. JVM is the key to the Java cross-platform, as long as the corresponding virtual machines for different platforms, the compilation generated by the same bytecode file can be interpreted and executed. The same bytecode cannot be run directly on different platforms, and the JVM is the translator that interprets execution.

Summary: Java cross-platform, because the same bytecode files on different platforms on different Java Virtual machine interpretation of execution, no virtual machine, it had to "hehe".

Talking about Java cross-platform

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.