Cross-platform java principle?

Cross-platform java principle?
First we have to understand what is cross-platform, cross-platform is the so-called piece of code written in JAVA can be run on any operating system platform.
Why cross-platform will become a problem? Because each operating system platform to support different instruction sets we write the code compiled after only applicable to a platform, a platform does not support the change. The JAVA perfect solution to this problem, JAVA is how to do this it? In the figure above, we can see the process JAVA code execution.
JAVA source code -> JAVA byte code -> JVM interpreted
we write JAVA source code is compiled into bytecode and then interpreted JVM virtual machine, we can see the JVM virtual machine to play in the process of cross-platform an important role, it is interpreted by the byte code and executed, corresponding to each platform has a JVM virtual machine, but only one byte code, windows of the JVM bytecode virtual machine can be interpreted as capable of instructions that execute on windows platform and implementation of Linux JVM bytecode virtual machine can be interpreted as instructions that can be executed on the Linux platform and executing the bytecode they perform are the same one. This realization of cross-platform.

Guess you like

Origin blog.51cto.com/11583017/2429905