The JVM can also execute code in other languages, such as Ruby,js, as long as they are compiled into a specification-compliant byte code
Related information can be Baidu JRuby, etc.
And Java itself compiles the bytecode of the tool that we all know Javac.exe
However, our compilation in Eclipse is not implemented by reading the JDK execution Javac, but using the ECJ compiler implemented by Eclipse, Javac with full-volume compilation, ECJ using incremental compilation, and Tomcat compiling JSP pages using ECJ
Compilation is divided into 4 parts
-
Lexical analysis
Converts content such as keywords and identifiers in the source code into a token sequence that conforms to the Java syntax specification, and then matches the checksum by the specified order rules (converting and verifying that the keywords and identifiers are correct)
2. Grammatical analysis
Integrate the token sequence into a syntax tree, such as a catch after a try (generate a syntax tree and verify that the syntax is correct)
3. Semantic Analysis
Extending the syntax tree
4. Generate bytecode (follow-up details)
How to download the deployment Javac compiler source code
Download.java.net/openjdk/jdk8
Create a new Java project and import or copy files from the/langtools/src/share/classes folder in the downloaded compressed file into the code area. Note Set your Eclipse compiler version to 1.5 or more, while the JRE uses as much of the Eclipse's own
"Java Virtual machine explaining" Reading notes-chapter II compilation principle of byte code