I found that sometimes this error appears and, simply by going to Project -> Clean... , the error stops.
However, if this does not work, there is a blog with a few suggestions here
Updated 07/11/2017
The source link is no longer available; refer to the web archive here
Or just all of them here.
- 'Clean up the Eclipse project: go to Project> Clean in Eclipse [This seems to work for me]
- Update the project folder (right click on your project> update)
- Restore your project
- Clean your builds (if using Ant or Maven - clean your builds)
- Create a new project in Eclipse
- 'Switch workspace - then switch (for example, "Change to debug", then return to Java)
- Remove and re-add the JRE:
- Right click on your project> properties
- Go to the Libraries tab
- Click JRE
- Click Delete, then OK.
- Repeat 1-3 again, but add the JRE again.
source share