尽管设置为 1.7,但 IntelliJ IDEA 13 仍使用 Java 1.5

编程入门 行业动态 更新时间:2024-10-23 21:37:56
本文介绍了尽管设置为 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> <mavenpiler.source>1.7</mavenpiler.source> <mavenpiler.target>1.7</mavenpiler.target> </properties>

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

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

更多推荐

尽管设置为 1.7,但 IntelliJ IDEA 13 仍使用 Java 1.5

本文发布于:2023-11-16 18:14:10,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1606645.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:设置为   IntelliJ   IDEA   Java

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!