error phenomenon
When using Idea to import a new project or upgrade an idea or create a new project, the following exception information will appear:
Error:java: Compilation failed: internal java compiler error
- 1
wrong reason
The reason for this error is mainly because of the jdk version problem. There are two reasons here, one is that the compiled version does not match, and the other is that the current project jdk version does not support.
View the jdk of the project
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 jdk of the project
Click on Modules in the image above to view the corresponding jdk version:
View java compiler version
When importing a java project, the probability of the problem here is more.
In response to this problem, reopening or modifying the contents 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>
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
Original link: https://www.choupangxia.com/topic/detail/68
Follow WeChat public
For more technology, architecture, management and other knowledge sharing, please pay attention to the WeChat public account: Program New Vision (ID: ershixiong_see_world)