how do I get eclipse to use a different compiler version for Java?

From the menu bar:
Project -> Properties -> Java Compiler

Enable project specific settings (checked)
Uncheck “use Compliance from execution environment ‘….
Select the desired “compiler compliance level”

That will allow you to compile “1.5” code using a “1.6” JDK.

If you want to acutally use a 1.5 JDK to produce “1.5” compliant code, then install a suitable 1.5 JDK and tell eclipse where it is installed via:

Window -> preferences -> Installed JREs

And then go back to your project

Project -> properties -> Java Build Path -> libraries

remove the 1.6 system libaries, and:
add library… -> JRE System LIbrary -> Alternate JRE -> The JRE you want.

Verify that the correct JRE is on the project’s build path, save everything, and enjoy!

Leave a Comment