IntelliJ IDEA compiles Java programs with 'Error:java: Invalid source distribution: 9' solution

IntelliJ IDEA compiles Java programs with 'Error:java: Invalid source distribution: 9' solution

The newly installed IntelliJ IDEA 2018.1 compiler, create a Java Project, and select the previously installed JDK configured by Eclipse, as shown in the figure:

Add Main.class to the project, write simple code in the main function, and then run, the error shown in the figure appears:

After searching for solutions on the Internet, I finally concluded the reason:
open 'File->Project Structure'

Select Modules -> Sources and change the Language level to something else, for example, 8 in this example

Then run the program successfully

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325735247&siteId=291194637
Recommended