简体   繁体   English

当我已经有 1.8 JRE 时,“仅在源代码级别 1.8 允许引用接口 static 方法”或更高版本

[英]"References to interface static methods are allowed only at source level 1.8" or above when I already have a 1.8 JRE

I got this error when trying to call a static method in a Maven project that I'm working on.尝试在我正在处理的 Maven 项目中调用 static 方法时出现此错误。 I thought that this error seemed odd, as I'm using 1.8.我认为这个错误看起来很奇怪,因为我使用的是 1.8。

Eclipse 说我已经在使用 1.8 JRE

Additionally, I added the following to my pom.xml :此外,我将以下内容添加到我的pom.xml

    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>

Neither solution seemed to work, and I'm puzzled as to why.这两种解决方案似乎都不起作用,我对原因感到困惑。 Any help is appreciated.任何帮助表示赞赏。

Right click on project -> properties -> Java Compiler -> set Compiler compliance level to 1.8.右键单击项目 -> 属性 -> Java 编译器 -> 将编译器合规级别设置为 1.8。

This fixed the problem for me.这为我解决了问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 仅在源代码级别 1.8 或更高版本才允许引用接口静态方法 - References to interface static methods are allowed only at source level 1.8 or above vscode 错误:仅在源代码级别 1.8 或更高版本才允许引用接口静态方法 - vscode error: References to interface static methods are allowed only at source level 1.8 or above Lamba在源级别仅允许1.8或更高 - Lamba are allowed at source level only 1.8 or above Java 8 Eclipse Luna 4.4 GWT 2.8错误:Lambda表达式仅在源级别1.8或更高级别上才允许 - Java 8 Eclipse Luna 4.4 GWT 2.8 Error: Lambda expressions are allowed only at source level 1.8 or above 本节内容不允许尾随 / lambda 表达式允许在源级别 1.8 或更高版本 - Content is not allowed trailing in this section / lambda expression are allowed at source level 1.8 or above 在Mac上安装JRE 1.7-已安装1.8版 - Install JRE 1.7 on Mac - when version 1.8 is already installed Eclipse中的JRE7 Unbound错误-我已安装1.8 - JRE7 Unbound error in eclipse - I have 1.8 installed Eclipse PDE:语法错误,类型注释仅在源级别至少为1.8时可用 - Eclipse PDE: Syntax error, type annotations are available only when source level is at least 1.8 未安装JDK 1.8,仅在Windows上安装了JRE - JDK 1.8 not being installed, only JRE on Windows 要求jre 1.3或更高。 (但是我已经安装了jre 1.8。) - require jre 1.3 or higher. ( But i have installed jre 1.8.)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM