尽管设置为 1.7,但 IntelliJ IDEA 13 仍使用 Java 1.5 [英] IntelliJ IDEA 13 uses Java 1.5 despite setting to 1.7

查看:29
本文介绍了尽管设置为 1.7,但 IntelliJ IDEA 13 仍使用 Java 1.5的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尽管在所有项目设置中(包括在File -> Project Structure -> Project :: Project SDK)中指定了JDK 1.7,但IntelliJ 13 会产生以下错误code> 尝试编译一些使用菱形运算符的简单 Java 7 代码时:

Despite specifying JDK 1.7 in all project settings (including in File -> Project Structure -> Project :: Project SDK), the following error is produced by IntelliJ 13 when trying to compile some simple Java 7 code which does use the diamond operator:

java: diamond operator is not supported in -source 1.5
(use -source 7 or higher to enable diamond operator)

配置中是否还有其他地方应该启用预期的 -source 7 选项?

Is there any other place in the configuration where the expected -source 7 option should be enabled?

推荐答案

如果这些都没有帮助(我的情况),您可以在 pom.xml 中进行设置,如下所示:

If nothing of this helps (my case), you can set it in your pom.xml, like this:

<properties>
  <maven.compiler.source>1.7</maven.compiler.source>
  <maven.compiler.target>1.7</maven.compiler.target>
</properties>

正如这里提到的这个很酷的人:https://stackoverflow.com/a/25888116/1643465

As this cool guy mentioned here: https://stackoverflow.com/a/25888116/1643465

这篇关于尽管设置为 1.7,但 IntelliJ IDEA 13 仍使用 Java 1.5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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