The JDK (JAVA_HOME) used to launch Eclipse is not necessarily the one used to compiled your project.
To see what JRE you can select for your project, check the preferences:
General ? Java Installed JRE
By default, if you have not added any JRE, the only one declared will be the one used to launched Eclipse (which can be defined in your eclipse.ini).
You can add any other JRE you want, including one compatible with your project.
After that, you will need to check in your project properties (or in the general preferences) what JRE is used, with what compliance level:
(source: standartux.fr)