Resource specification not allowed here for source level below 1.7

When starting a java program that received the 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 use java 1.7.25 and all the eclipse settings are in place, but not sure why this error occurs

SOLUTION.

The problem was solved by updating the project in eclipse using maven.

+7
java
source share
1 answer

Despite the fact that you are using Java 1.7, you can compile the source code as if you had a compiler from Java 1.6 (this can be useful, for example, for cross-compiling). Like Shivam Tiwari in Eclipse you can change it in window-> preferences-> java-> Compiler Compiler

If you are using Maven, you must 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> 
+12
source share

All Articles