If you have recently installed Java 7, chances are that you might be facing errors using the brand new features of Java 7. This is because of Eclipse Java 7 compliance issue of the compiler.
Follow the steps listed below to fix these errors and run programs using new features of Java in eclipse.
1) First of all make sure your eclipse version is at least Indigo SR1.
2) Go To Windows -> Preference -> Java -> Compiler. In the “Compiler compliance level” dropdown, select 1.7
3) Go To Windows -> Preference -> Java -> Installed JREs and click on Add button. In the popup which comes up, select Standard VM and hit Next button. On the next screen, click the Directory button and navigate to the path where your JDK is installed. Click Finish.
4) You should see the new JRE listed on the Installed JREs screen now. Select that and click OK.
5) If you have installed 64 bit JDK, make sure you have downloaded 64 bit version of eclipse as well.
You should now be all set the use the new features of Java 7 in eclipse.