无法解析导入java.time

无法解析导入java.time,java,Java,您好,我正在使用eclipse Mars,生成了以下错误消息: Caused by: java.lang.Error: Unresolved compilation problems The import java.time cannot be resolved LocalDateTime cannot be resolved to a type LocalDateTime cannot be resolved 我只是想解决这个问题,我想我应该使用JDK 8,但我不知道在eclipse中使用它

您好,我正在使用eclipse Mars,生成了以下错误消息:

Caused by: java.lang.Error: Unresolved compilation problems
The import java.time cannot be resolved
LocalDateTime cannot be resolved to a type
LocalDateTime cannot be resolved

我只是想解决这个问题,我想我应该使用JDK 8,但我不知道在eclipse中使用它。

确保选中并清除了Build
automatic
。如果它不起作用,重新启动Eclipse并再次执行。

您需要将Eclipse的java编译器级别设置为1.8。进入preferences、java、compiler,您将看到其中的设置。我已经完成了这些工作,问题是我的库java.time中没有LocalDateTime