问题描述
正在运行的Java程序在Eclipse中出现以下错误
原因:java.lang.Error:未解决的编译问题:低于1.7的源代码级别此处不允许使用资源规范
尽管我使用的是Java 1.7.25,并且所有的eclipse设置都已经到位,但不确定为什么会出现此错误
解决方案.
通过使用Maven在Eclipse中更新项目解决了问题.
尽管您使用的是Java 1.7,但仍可以像使用Java 1.6编译器一样编译源代码(例如,对于跨汇编).正如 Shivam Tiwari 在Eclipse中所说,您可以在window-> preferences-> java-> Compiler Compiler中进行更改>
如果您使用的是Maven,则应添加以下插件:
< plugin>< groupId> org.apache.maven.plugins</groupId>< artifactId> maven-compiler-plugin</artifactId>< version> 2.5.1</version><配置>< source> 1.7</source>< target> 1.7</target></configuration></plugin>
While running java program getting following error in eclipse
Caused by: java.lang.Error: Unresolved compilation problem:
Resource specification not allowed here for source level below 1.7
Although I am using java 1.7.25 and all eclipse settings are in place but not sure why getting this error
SOLUTION.
Problem solved by updating project in eclipse using maven.
Despite of the fact that you are using Java 1.7 you can compile source code as if you had compiler from Java 1.6 (this can be useful for example for cross-compilation).As Shivam Tiwari said in Eclipse you can change it in window->preferences->java->Compiler Compiler
If you are using Maven you should add the following plugin:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
这篇关于低于1.7的源代码级别此处不允许使用资源规范的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!