Upgrade to java 1.7 in eclipse on mac

eclipsejavajdkjre

I'm sort of a beginner with eclipse but I want to update the libraries or build path or whatever to java 1.7 from java 1.6 and I can't figure it out. I'm a computer science student at the university of washington and various TA's and students have tried to figure out this problem but it's stumped them all. I've installed java 1.7 from Oracle a few times already and the java section of system preferences says I have 1.7 but java -version in terminal says:

java version "1.6.0_41" Java(TM) SE Runtime Environment (build
1.6.0_41-b02-445-11M4107) Java HotSpot(TM) 64-Bit Server VM (build 20.14-b01-445, mixed mode)

What's going on here? My mac is totally up to date on everything else

Best Answer

You need to add jdk 1.7 in the build path of your project in eclipse. Follow below steps.

  1. Right click on project
  2. Select buil path=>configure build path
  3. Select Java Build Path => Library
  4. Click Add Library=>JRE System Library =>Click next.
  5. Now select and add jdk1.7 installation location.
  6. Now click on Java Compiler => select Java compiler to 1.7.

Note All version of eclipse does not include facet support for JDK 1.7 compiler. I will recommend you to download Eclipse Juno. Eclipse juno has inbuilt facet support for jdk 1.7 compiler.

Related Question