Here's the working solution for this problem:
Step 1: Right click on project and go to properties
Step 2: Go to 'libraries' and remove the project's ' JRE system library'
Step 3: Click on 'Add library'-->'JRE System Library' -->select 'Workspace default JRE'
Step 3: Go to 'Order and Export' and mark the newly added ' JRE system library'
Step 4: Refresh and Clean the project
Eureka! It's working :)