問題描述 問題解決 首先檢查編輯器是否已經設置為1.7: Right click your project > Properties > Java Compiler and set “Compiler compliance level” to 1.7 然後,檢查Project Facts: Next...
問題描述
問題解決
首先檢查編輯器是否已經設置為1.7:
Right click your project > Properties > Java Compiler and set “Compiler compliance level” to 1.7
然後,檢查Project Facts:
Next from the menu on the left select Project Facets > Java and set its version to 1.7;
如果還沒有添加jdk1.7,則需要先添加:
Navigate to eclipse Preferences > Java > Installed JREs, click Add, and locate your installed Java path.
對maven項目,在pom.xml中添加如下配置:
<build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.1</version> <configuration> <source>1.7</source> <target>1.7</target> </configuration> </plugin> </plugins> </build>
最後,更新工程:
right click on your project > Maven > Update Project…