What processes does javac compilation include?
What processes does javac compilation include?
The java compilation process is mainly divided into the following steps:
1. Lexical analysis : Convert the characters in the source code (various keywords, variables, etc.) into a set of tokens, the smallest unit of program writing for a single character, and token is the smallest unit of the compilation process.
2. Syntax analysis: Construct a collection of tokens into an abstract syntax tree. Each node of the syntax tree represents a syntax structure in the code (such as package, type, interface, modifier, etc.).
3. Fill the symbol table: The symbol table is a table composed of a set of symbol addresses and symbol information. The exit from the process of filling the symbol table is a pending list containing the top-level nodes of each abstract syntax tree (and package-info.java).
4. Plug-in annotation processor processes annotations: The annotation processor can add, delete, or modify any element of the abstract syntax tree. Therefore, whenever the annotation processor modifies the syntax tree, steps 1, 2, and 3 will be re-executed until the annotation processor no longer modifies the syntax tree. Each cycle process is called a Round.
5. Semantic analysis: Context-sensitive review of source programs that are correct in syntax tree structure.
Annotation check: including whether variables are declared, whether variables and assignment types match, etc., and constant folding.
Data and control flow analysis: further verification of program context logic. Including whether variables are assigned values before use, whether methods have return values, whether exceptions are handled correctly, etc.
6. Decode syntax sugar: Convert advanced syntax (such as generics, variable parameters, unboxing, etc.) into basic syntax structures. These are not supported when the virtual machine is running. Advanced syntax.
7. Generate bytecode: Convert the information in the syntax tree and symbol table into bytecode and write it to the disk, while performing a small amount of code addition and conversion work.
Most of the above content is excerpted from: "In-depth Understanding of Java Virtual Machine" -- Zhou Zhiming
Recommended tutorial: "java tutorial"
The above is the detailed content of What processes does javac compilation include?. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



The difference between Javac and Java is mainly reflected in functions, parameter configuration, usage scenarios, compilation process and execution process, interactivity and version compatibility. Detailed introduction: 1. Function, Javac is a Java compiler. Its main function is to compile Java source code into bytecode to generate executable Class files. Java commands are part of the Java runtime environment. Its main function The function is to execute Java programs or jar packages; 2. Parameter configuration, the parameter configuration of Javac and Java is also different, etc.

The "javac is not an internal or external command" error indicates that the system does not recognize the javac command. javac is a Java compiler used to compile Java source code into bytecode. This error usually occurs when: * The Java Development Kit (JDK) is not installed. * JDK installation path is not added to environment variables.

Resolution steps include: check the JDK installation, find the JDK installation path, add the JDK's bin directory to the PATH environment variable, verify the environment variable, check the javac version, reinstall the JDK, run javac using an absolute path, and make sure to reboot after making changes Command line window.

You may be eager to install Java, write a Java program and run it. But before that, there are some concepts that need to be understood in advance, because Java is a little different from C, C++ and Python. Compilation and Execution We write English codes in text files. Computers cannot understand these English codes, so they need to be converted into a format that the computer can recognize and run. This conversion is completed by the "compiler" . Some languages do not have compilers, but Java does. The file converted by the compiler is usually called a binary file, or executable file. The file content is changed from English to bytecode. Only computers can understand bytecode, not humans, so we don’t need to care, we just need to ensure that the code we write

What should I do if javac is not an internal or external command? After using environment variables and other configurations, users often encounter this situation, etc., resulting in the failure to use it normally. This problem may be due to improper settings or environmental configuration. problem, then come here to see the detailed tutorials and solutions~ What to do if javac is not an internal or external command: 1. Find the bin directory under the java installation, run it, enter it, and it will prompt, indicating that there is a problem with the environment configuration 2. Then Open the input: 3. Check if there are any extra symbols in the java-related java-related paths, such as extra semicolons and commas. As shown in the picture above, the normal path is correct: wrong: 4. After making the mistake, right-click, click to select 5, then open 6 on the left, and then

javac is not an internal or external command and is not an operable program. Solution: 1. Confirm whether the JDK is installed correctly; 2. Configure environment variables, open the system properties window, click "Advanced System Settings", click the "Environment Variables" button, and Find the "Path" variable in "System Variables", click the "Edit" button, and add the JDK installation path at the end of the variable value; 3. Check the JDK installation path; 4. Check the firewall and anti-virus software; 5. Reinstall the JDK.

Solution to javac not being an internal or external command in Java During the process of Java programming, we often use the command line window to execute the javac command to compile Java source code files. However, sometimes when executing the javac command, an error message "javac is not an internal or external command" will appear, which will cause us to be unable to compile Java programs normally. This article explores the root cause of this problem and provides a solution, along with specific code examples. 1. Analysis of root causes of problems When we are alive

Many users find that javac cannot operate normally when using javac in win7 system. In fact, this problem should be because jdk is not installed, so it cannot operate normally. If both are installed and still cannot be used, you need to set the environment variables. What should I do if win7javac is not an internal or external command: 1. First check whether jdk and jre have been installed successfully. If it still cannot be used after the installation is completed, configuration, please perform the following operations. 2. Open the environment variable settings, then find and edit, and put the variable value into your installation location, for example: 3. Then find it. Enter 4, then open it and enter. Then after confirming and saving, you can perform normal configuration and use.
