solution for: Error: java: Compilation failed: internal java compiler error

created at 12-23-2021 views: 29

Problem Description

Error message:

Error:java: Compilation failed: internal java compiler error

Reason

The local Java version is inconsistent with the Java version in the project

View local Java version

> java -version
java version "1.8.0_172"

Solution

Use shortcut key Ctrl+Alt+Shift+S to open Project Structure

1) Select Project, modify the project Java to be consistent with the local Java version

modify java version

2) Select Modules, modify the project Java to be consistent with the local Java version

modules java version

3) Modify the Java configuration in IDEA

Modify the Java configuration in IDEA

The above picture is the main reason for the error, which is caused by the inconsistency between the Java version in the IDEA environment and the Java version in the project.

created at:12-23-2021
edited at: 12-23-2021: