My Eclipse 3.4.2 does not compile Java 1.6 on Mac OS 10.5.6, does anyone here got it working? Seems that no matter which JRE I choose, it keeps compiling using 1.5.
You can go in to your application properties.
Right click on project->properties->Java Compiler
Then click on "Enable Project Specific Settings." And choose the Compiler Compliance Level: 1.6
Another thing to note: Be careful as to what compiler your eclipse is using. I recently installed Fedora 10, and the eclipse that installed from: "yum install eclipse" shipped with some IBM javac that REFUSED to compile some java 1.6 specific code, despite claiming to be 1.6 compliant.
and of course: check to see what java and javac versions are installed.
which java
which javac
in the terminal.
Also, switching your JRE will not solve this problem, as that is the runtime environment, not the compiler.
Question: Are you certain you have Java 6 installed?
To verify, look in :
/System/Library/Frameworks/JavaVM.framework/Versions
You should see 1.6.
If 1.6 is there, do you have it installed as a JRE in Eclipse?
To verify this: Pref -> Java -> Installed JREs (JDK 6 should be there), but make sure it points to:
/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home
Other than that, there is nothing else required to compile Java code for 1.6 with Eclipse on the Mac.
Note: Make sure you check the project level too as suggested above.
If all else fails, you can also try SoyLatte JDK, it is an open source version of Java for the Mac based on a BSD port of the OpenJDK project.