Error building Java Program in Eclipse Mars after changing Java version

Right Click on the Project in the Package Explorer.
Select Build Path -> Configure Build Path -> Libraries.
Now remove JRE System Library 1.7 and add the one for java-8-oracle by clicking on Add Library -> JRE System Library -> Click Execution Environment and set that to JavaSE-1.8 (java-8-oracle).
Click Finish.

This resolves the error when building the Java program.