Java. Warning – Build path specifies execution environment J2SE-1.6

eclipse新建web项目提示Java. Warning – Build path specifies execution environment J2SE-1.6

问题描述:

在下方的 Problems 选项卡中可以看见工程警告:

Description Resource Path Location Type
Build path specifies execution environment JavaSE-1.6. There are no JREs installed in the workspace that are strictly compatible with this environment. TestStructs Build path JRE System Library Problem

解决方法:

右键当前项目,选择 properties,在新窗口中选择 java build path,然后切换到 Libraries 选项卡,移除“JRE System Library[J2SE 1.6]”:
Java. Warning – Build path specifies execution environment J2SE-1.6

接着单击“Add Library”,在新窗口中选择 JRE System Library:

Java. Warning – Build path specifies execution environment J2SE-1.6

最后选择 “Executin Environment” 或默认 Workspace default JRE:
Java. Warning – Build path specifies execution environment J2SE-1.6

替换之后如下:
Java. Warning – Build path specifies execution environment J2SE-1.6

总结体会:

以前遇到这种情况直接无视,只要程序不出现错误就算通关。现在不知为何有点强迫症,无法容忍程序中的警告。可能是心境不同了吧,编程也需要良好的体验。