I was getting an additional warning
The compiler compliance specified is 1.6 but a JRE 1.8 is used
Resolving this warning make the error also go away. The steps are as follows:
I right-clicked on it, then clicked on Quick Fix
. From the dialog that opened I selected Open the Compiler Compliance property page
, and clicked the Finish
button.
(This is same as Java Compiler
section.)
In this dialog I found the Compiler compliance level
drop down and changed 1.6
to 1.8
, and clicked on Apply and close
.
I got a message box Compiler Settings Changed
which asked if I wanted to Build the project now?
. I clicked on Yes
.
The build path error went away.