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 just installed Oracle's Java version 7u7 on my Mac (running OSX Mountain Lion). However, when I run java -version it still displays the old version (6u29).

Displaying Java 6 and 7 side by side

How do I fix this? Do I even need to fix this? What version will browsers (Firefox) use in this case? And what version will be used when I run Java applications directly?

I've seen this question but this doesn't work in my situation (probably because this question is about the JRE and the other question about the JDK). In my case the Java Preferences app only displays Java 6 versions (32 bit and 64 bit).

enter image description here

Update:

  • which java points to /usr/bin/java
  • /usr/bin/java is a symlink to /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java
  • /System/Library/Frameworks/JavaVM.framework/Versions/ only contains the folder A (awesome version name) - which Current points to.
share|improve this question
    
Did you reboot after installing 7up7? I don't know exactly how it works on Mac, but if it's anything like linux, it'll go through your path (environment variable) looking for the java executable. Sometimes java will explicitly put the directory into the path on installation, other times it'll just assume the place it's installing to is on the path. –  MBraedley Sep 25 '12 at 15:08
    
Reboot didn't solve the problem. –  Sebastian Krysmanski Sep 25 '12 at 18:11
    
run which java from terminal. It'll tell you where the system is running the executable. For instance, on the linux machine in front of me, it says it's /usr/bin/java, and the ll /usr/bin/java says that it's a sym link to the actual install. –  MBraedley Sep 25 '12 at 18:52
    
I've updated the question with the information. However, they don't seem to help much. –  Sebastian Krysmanski Sep 26 '12 at 7:33

2 Answers 2

up vote 3 down vote accepted

Ok, thanks to MBraedley I found the solution.

Quoting from the JRE 7 Installation Guide for Mac OS X:

Installing a JRE from Oracle will not:

  • Update java -version symlinks or add java to your path.
  • Show the installed JRE in the Java Preferences.app

To be able to do the above, you need to install the JDK.

share|improve this answer
1  
Any idea how to do this when the JDK is installed? /usr/libexec/java_home gives me /Library/Java/JavaVirtualMachines/jdk1.7.0_13.jdk/Contents/Home, but the symlinks still point to /System/Library/Frameworks/JavaVM.framework/Versions/Current/. –  Koraktor Feb 14 '13 at 21:22

put this in your start up script (.profile, .bash_profile etc):

export JAVA_HOME=$(/usr/libexec/java_home)

It's possible you are setting JAVA_HOME to the wrong version. Before Java 7, I had

export JAVA_HOME=/Library/Java/Home/

and I was still getting Java 6.

share|improve this answer

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.