在eclipse中运行java程序时遇到以下错误
Caused by: java.lang.Error: Unresolved compilation problem:
Resource specification not allowed here for source level below 1.7
Run Code Online (Sandbox Code Playgroud)
虽然我使用java 1.7.25并且所有eclipse设置都已到位,但不确定为什么会出现此错误
解.
使用maven在eclipse中更新项目解决了问题.
Iva*_*tyk 17
尽管您使用的是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>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)