错误:java:无效的源版本:Intellij 中的 8.这是什么意思? [英] Error:java: invalid source release: 8 in Intellij. What does it mean?

查看:43
本文介绍了错误:java:无效的源版本:Intellij 中的 8.这是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 Intellij Ultimate 13.1.4 编译一些代码,但出现以下错误,我不知道这是什么意思:

Im trying to compile some code in I'm using 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

我的猜测是它与 Java 8 和 Java 7 相关,但我不知道具体是什么.我已经尝试在谷歌上搜索这条消息,但他们要么谈论 javac 要么谈论 target release,所以它似乎并不完全适用.

My guess is that its 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.

推荐答案

我在将项目从 Java 8降级"到 Java 6 时遇到了同样的问题.原因是 IntelliJ 中的所有地方都没有更改.

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.

在 IntelliJ 13.1.4 中,我必须在以下位置更改 Java 和 SDK 版本才不会出现此错误:

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

  • 文件 -> 项目结构 -> 项目设置
  • 文件 ->项目结构 -> 模块设置 -> 标签:来源:语言级别
  • 文件 -> 项目结构 -> 模块设置 -> 选项卡:依赖项:模块 SDK
  • 文件 -> 设置 -> 编译器 -> Java 编译器 -> 目标字节码版本

最后一个项目是我的案例中没有更新的项目.一旦我改变了这一点,错误就消失了.

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

这篇关于错误:java:无效的源版本:Intellij 中的 8.这是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆