Check two things
Eclipse preferences
- Check your Eclipse preferences:
Java->Installed JREs - The one that you’re using should be marked and it should be a JDK not just a JRE.
Project build path
- Also check your project’s build path: Right click on the project ->
Properties->Java Build Path - Check in the
librariesfolder whether the JRE System Library is present and … - If not add it using
Add library->JRE System Libraryand then
select the correct one (from an installed JDK).