This error is due to JRE System Library. Maybe you didn't give appropriate JRE for eclipse project to run. SO follow below steps.
- Right-click on the project and choose properties.
- Click on the Java Build Path option in the left side menu.
- From the Java Build Path window, click on the Libraries Tab.
- Make sure JRE System library is listed, if it is not listed then you can add, by clicking "Add Library" from the right side menu.
- So if JRE System Library is already listed then double click on JRE System Library which was showing error on Java Build Path window Libraries tab previously .
- Then it will open another window called JRE System Library . So in that window choose Alternate JRE . From that drop down choose your JRE.
In my case, it is java-8-openjdk-amd64 , as I am using ubuntu 16.04. Like that you can also choose your JRE System library .