[Java exception] Error:java: Compilation failed: internal java compiler error solution

1. Error description

Just after importing a new project through IDEA, an error was reported when running, as shown below:

Error:java: Compilation failed: internal java compiler error

2. Cause of error

The reason for this error is mainly due to  the JDK  version problem. There are two reasons. One is that the compiler version does not match, and the other is that the current project  JDK  version is not supported. Once you know the cause, it is easy to solve the problem. The solution is as follows. 

3. Solution

The JDK versions in the following three places must be consistent, otherwise an error will occur.

3.1 . Check the JDK version of the project

File --> Project Structure --> Project Settings --> Project or use the shortcut key Ctrl + Alt + shift + S to open the project's JDK configuration, as shown below: Check whether these two places are consistent with the target JDK.

3.2. Check the JDK version of the project

File --> Project Structure --> Project Settings --> Modules or use the shortcut key Ctrl + Alt + shift + S to open the project's JDK configuration, as shown below: Check whether these two places are consistent with the target JDK.

3.3 . Check the JDK version of the IDEA editor

File --> Settings --> Build, Execution, Deployment --> Compiler --> Java Compiler or use the shortcut key Ctrl + Alt + S to open the configuration, click Java Compiler to view the target version as shown in the figure (Target bytecode version): Check the JDK version here.

Expansion: If someone is like me, it was running fine the last second, but suddenly hung up, you can refresh Maven  again.

The above is my solution to this error!

Reference article:  [Java Exception] Error:java: Compilation failed: internal java compiler error solution_No8g Siege Lion’s Blog-CSDN Blog

Guess you like

Origin blog.csdn.net/m0_50370837/article/details/126364338