我正在尝试在使用 Intellij Ultimate 13.1.4 时编译一些代码,但出现以下错误,我不知道这意味着什么:
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
我的猜测是它与 Java 8 和 Java 7 有关,但我不知道具体是什么。我试着用谷歌搜索这条消息,但他们要么谈论 javac
要么 target release
,所以它似乎并不完全适用。
原文由 David says Reinstate Monica 发布,翻译遵循 CC BY-SA 4.0 许可协议
我在将项目从 Java 8“降级”到 Java 6 时遇到了同样的问题。原因是它在 IntelliJ 中的所有地方都没有改变。
在 IntelliJ 13.1.4 中,我必须在以下位置更改 Java 和 SDK 版本才能避免出现此错误:
最后一个项目符号是我的案例中未更新的项目符号。一旦我改变了这个,错误就消失了。