我试图编译一些代码在我使用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
Run Code Online (Sandbox Code Playgroud)
我的猜测是它与Java 8和Java 7有关,但我不知道具体是什么.我试图谷歌周围的这个消息,但他们要么谈论javac或target release,所以它似乎并不完全适用.
您好,我已从 java 8 升级到 java 11,无论如何我都会收到此错误。我使用的是 Intellij 和 windows 10。我已更改为 11:1)在项目结构 -> 项目中:

3)我的编译器模块目标字节码版本在设置->构建、执行、部署-> Java编译器中也设置为11。
我什至将用户变量中的 JAVA_HOME 和系统变量中的 JAVA_HOME 两个环境变量分别更改为 jdk-11.0.8。
当我运行 java -version 和 javac -version 时,都显示我安装了版本 11。当我尝试运行 mvn clean 包时,它总是因此错误而失败
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (default-compile) on project abc: Fatal error compiling: invalid
target release: 11 -> [Help 1]
Run Code Online (Sandbox Code Playgroud)
请帮我修复错误,任何帮助将不胜感激!
LE这是项目 pom 的一部分
<plugin>
<inherited>true</inherited>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<optimize>true</optimize>
<encoding>UTF-8</encoding>
<showWarnings>true</showWarnings>
<showDeprecation>true</showDeprecation>
<compilerArguments>
<parameters/>
</compilerArguments>
</configuration>
Run Code Online (Sandbox Code Playgroud)
我也添加<release>11</release> <!--or <release>10</release>-->了它,但同样的问题仍然存在。
我的项目在命令行上运行,但无法在 IntelliJ 中运行。我已经尝试了以下问题中的所有解决方案:
有谁知道为什么 InteliJ 不使用我定义的 JDK?