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

migrated from stackoverflow.com Mar 12 '13 at 9:45

This question came from our site for professional and enthusiast programmers.


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.

  • This will help only in eclipse, but won't fix the problem on the Mac terminal, I guess. – Hannes M Mar 12 '13 at 6:39
  • Ok I am a windows user i don't know MAC. But i want to help you similar ways we do in windows. We set JAVA bin folder to system PATH variable. While doing so terminal will find java.exe from the folder specified in PATH variable. – Real Mar 12 '13 at 6:44

it seems that you have both java versions installed in parallel

First you can try this: http://docs.oracle.com/javase/7/docs/webnotes/install/mac/mac-preferences.html

  • Goto Applications -> Utilities -> Java Preferences
  • To make JRE 7 the default version of Java, re-order the list by dragging Java SE 7 to the top of the list.

If this doesn't help, your PATH variable is pointing to the wrong installation.

Open you .profile file in your home directory (e.g., with open ~/.profile from our treminal) and check for a line like export PATH=/ and let it point to the directory you installed your oracle java 7 into.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy