That exception indicates that the compiler being used is NOT Java 8.
Therefore you must have multiple versions of Java on that machine and Eclipse is using an earlier version.
Find and remove all of the other Java versions and make sure your environment variables only reference Java 8.
For further help you need to post in an Eclipse forum since yours is NOT a Java problem.
Or rather, switch to an IDE that supports Java 8, then set up the project to use that language level and compiler.
Eclipse uses a built in compiler, not an external one (those are used only as a runtime), and all but the very latest Eclipse versions won't be able to compile to Java 8 simply because they lack the support for it.
So, just an FYI for using eclipse, the version you are using, and that comes through on your command-line "java -version" may not be the version you're using in Eclipse.
First, you need to check what version of Java you're using in Eclipse:
- Open Eclipse
- Browse to the "Preferences" window
- Click on "Java"
- Click on "Installed JREs"
- In this window you will see a list of directories. Each should point to the JAVE_HOME directory of a separate installation. Do you see the checked one pointing to a Java 8 installation? If NO, then do the following steps:
- Click 'Add'
- Click on 'Standard VM' and 'Next'
- Under the 'JRE_HOME' field, click on 'Directory'
- Browse to the JAVA_HOME directory (this is the base directory, where your 'bin', 'include', and 'lib' directories reside) for your Java 8 installation
- Once you click it, if it's a valid JAVA_HOME directory, all the info should fill in automatically.
- Click Finish
- Once you finish this, make sure this entry is checked. Click OK.
- Go back and try again. GOOD LUCK!