Tag Archives: Error:java: Compilation failed: internal java compiler error

[Solved] Error:java: Compilation failed: internal java compiler error

Error:java: Compilation failed: internal java compiler error
problem
Error: Error:java: Compilation failed: internal java compiler error
After you change the module-language level, it will report the error above.
Solution:
preferences ->build,execution,deplyment -> java compiler -> Select 8(default is 1.5)

[Solved] Error:java: Compilation failed: internal java compiler error

Error phenomenon
When using Idea to import a new project or upgrade an idea or create a new project, the following exception message will appear:

Error:java: Compilation failed: internal java compiler error

The reason for
this error is mainly due to the jdk version problem. There are three reasons here, one is insufficient memory, the other is the compiled version does not match, and the other is that the jdk version of the current project does not support.

Not enough storage

Use the shortcut key Ctrl+Alt+shift+S to open the jdk configuration of the project and increase the memory:

View the project’s jdk

File ->Project Structure->Project Settings ->Project or use the shortcut key Ctrl+Alt+shift+S to open the jdk configuration of the project:

Check whether these two places are consistent with the target jdk.

View the project’s jdk

Click Modules in the figure above to view the corresponding jdk version:

 View java compiler version

When importing the java project, the probability of the problem here is more.

In response to this problem, reopening or modifying the content of the pom file (maven project) is likely to cause the jdk version to change to 1.5 again. If it is a maven project, you can specify jdk related information in the pom file:

<build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>
        </plugins>
    </build>