IntelliJ Idea compilation error: please use -source 7 or higher to enable diamond operator.

I have encountered some setbacks in using IntelliJ Idea recently, and I would like to share it with you. The cause of the problem is that I imported an external Java file, and the result was an error

IntelliJ Idea’s default JDK is 1.5. So I tried every modification and it didn’t work. We have to make this amendment

Choose a 7.0 or higher version, alas, wasted half a day.

(2)IDEA Error:java: Compilation failed: internal java compiler error

The reason for the error

This error is mainly caused by the JDK version, there are two reasons, one is the compile version does not match, one is the current project JDK version does not support.

View the JDK for your project

File ->Project Structure->Project Settings ->Project or use the shortcut Ctrl+Alt+ Shift +S to open the JDK configuration of the Project:

View the project’s JDK

Click on Modules to see the corresponding JDK version:

View the Java compiler version



There is a high probability of problems everywhere when importing Java projects.