javaintellij-ideacompilationjavacintellij-13

Error:java: invalid source release: 8 in Intellij. What does it mean?


I'm trying to compile some code that I have in IntelliJ Ultimate 13.1.4, but I get the following error, and I have no idea what it means:

Information:Using javac 1.7.0_55 to compile java sources
Information:java: Errors occurred while compiling module 'Example'
Information:Compilation completed with 1 error and 0 warnings in 3 sec
Information:1 error
Information:0 warnings
Error:java: invalid source release: 8

My guess is that it's something related to Java 8 vs Java 7, but I have no idea what specifically. I've tried to Google around for this message, but they either talk about javac or target release, so it doesn't exactly seem to apply.


Solution

  • I had the same issue when "downgrading" a project from Java 8 to Java 6. The reason was that it was not changed at all places in IntelliJ.

    In IntelliJ 13.1.4 I had to change Java and SDK version on the following places not to get this error:

    screen shot of File > Project Structure > Project

    screen shot of File > Project Structure > Modules > Sources

    screen shot of File > Project Structure > Modules > Dependencies

    screen shot of File > Settings/Preferences > Compiler > Java Compiler

    The last bullet was the one that was not updated in my case. Once I changed this, the error disappeared.