Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

share|improve this question

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

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

2 Answers 2

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.

share|improve this answer
    
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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.