JVM: Java Virtual Machine, which simulates the instruction set of Java bytecode through software, is the running environment of Java programs
1. Where the JVM is from development to run
From the diagram above, there are the following steps from developing a Java program to executing it
1. Write Java source code – done by developers
2. Java source code is compiled into Java virtual machine input, Java bytecode — executed by JavAC
3. The Java VM executes the operating system instructions in response to the Java bytecode
4. The operating system executes specific hardware instructions
2. Main functions of JVM
1. Use the ClassLoader to find and load class files
2. Interpret the bytecode into instructions and execute them, providing a runtime environment for class files
3. Perform runtime memory allocation and garbage collection
4. Provide a platform to interact with hardware
3. Virtual machines are Java platform-independent guarantees
Judging from the above picture, we can draw the following conclusions:
1. Our development is platform independent.
2. Java Virtual machines are platform specific. Java VMS perform different operations on different platforms.
3. Java bytecode is loaded into the Java virtual machine, not Java source code. You can derive a feature that is independent of the development language. You don’t need a Java source file to compile a class file. For example, jRuby, jPython and other languages on the market can compile class files for Java virtual machines to execute