我正在使用Eclipse Oxygen并尝试将sourceLevel更改为1.8。每次我尝试运行我的程序时,都会收到以下控制台输出:
Runing CodeServer with parameters: [-noprecompile, -port, 54953, -
sourceLevel, 1.7, -bindAddress, 127.0.0.1, -launcherDir,
C:\Users\heyerj\eclipse-workspace\Zoo\war, -logLevel, INFO, com.zoo.gxt.project.Zoo]
Super Dev Mode starting up
workDir: C:\Users\heyerj\AppData\Local\Temp\gwt-codeserver-4320248131930738092.tmp
Loading Java files in com.zoo.gxt.project.Zoo.
Ignored 1 unit with compilation errors in first pass.
Compile with -strict or with -logLevel set to TRACE or DEBUG to see all errors.
Finding entry point classes
Tracing compile failure path for type 'com.zoo.gxt.project.client.Zoo'
[ERROR] Errors in 'file:/C:/Users/heyerj/eclipse-
workspace/Zoo/src/com/zoo/gxt/project/client/Zoo.java'
[ERROR] Line 215: Lambda expressions are allowed only at source level 1.8 or above
[ERROR] Line 223: Lambda expressions are allowed only at source level 1.8 or above
[ERROR] Line 247: Lambda expressions are allowed only at source level 1.8 or above
[ERROR] Hint: Check the inheritance chain from your module; it may not be
inheriting a required module or a module may not be adding its source path
entries properly
我检查了Poperties> Java Compiler,它设置为在Java Build Path上使用JavaSE-1.8。 Java Build Path有一个指向JavaSE-1.8(Eclipse)的JRE系统库。
在Window> Preferences中,编译器合规性级别也设置为1.8。我所有必需的运行配置都将其JRE执行环境设置为JavaSE-1.8(Eclipse)。我的eclipse.ini文件显示应该在Java 1.8中启动。
最后,我还尝试删除gwt-unitCache并删除Project(但不是所有文件)并重新导入它。我错过了什么?
在你的输出中它有:sourceLevel, 1.7
。这需要是1.8。
查看项目的GWT开发模式运行配置。在JRE部分中,查看运行时JRE的设置。
另一件事,你使用GWT 2.8 SDK吗?您需要GWT 2.8来使用Java 8语言功能,例如lambdas。顺便拜访:
project properties > GWT > General Settings > GWT SDK