我试图在我使用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

我猜这与Java8和Java7有关,但我不知props 体是什么.我试着在谷歌上搜索这条消息,但他们要么说javac,要么说target release,所以这似乎并不适用.

推荐答案

当我把一个项目从Java8"降级"到Java6时,我也遇到了同样的问题.原因是IntelliJ中的所有地方都没有改变.

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

  • File -> Project Structure -> Project Settings
  • File -> Project Structure -> Module Settings -> Tab: Sources: Language Level
  • File -> Project Structure -> Module Settings -> Tab: Dependencies: Module SDK
  • File -> Settings -> Compiler -> Java Compiler -> Target bytecode version

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

最后一个子弹在我的案子中没有更新.一旦我改变了这个,错误就消失了.

Java相关问答推荐

如何在Java中设置字符串与中文字符对齐?

在FML中删除关键帧动画

Saxon 9:如何从Java扩展函数中的net.sf.saxon.expr. XPathContent中获取声明的变量

如何使用解析器组合子解析Java数组类型签名?

如何在Docker容器中使用wireock—Webhooks阻止请求?

无法找到符号错误—Java—封装

使用包私有构造函数强制子类Java类

使用Java Streams API比较两个不同的Java集合对象和一个公共属性

需要一个找不到的jakarta.sistence.EntityManager类型的Bean

JVM会优化这个数学运算吗?

Java中如何根据Font.canDisplay方法对字符串进行分段

暂停计时器

如何使用路径过渡方法使 node 绕圆旋转?

如果List是一个抽象接口,那么Collectors.toList()如何处理流呢?

为了安全起见,有必要复制一份 list 吗?

我无法在我的Spring Boot应用程序中导入CSV依赖项

如何在JSP中从select中获取值并将其放入另一个select

获取401未经授权,即使在标头中设置了浏览器名称和cookie

当我将鼠标悬停在javafxTextArea上时,如何更改鼠标光标?

[Guice/MissingImplementation]:未绑定任何实现