Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I downloaded and installed Java 1.7 from this site.

When I run the Java Control Panel, I could check I have it correctly installed.

enter image description here

However, when I checked the Java version from command line, the version that I use is Java 1.6.

java -version
java version "1.6.0_33"
Java(TM) SE Runtime Environment (build 1.6.0_33-b03-424-11M3720)
Java HotSpot(TM) 64-Bit Server VM (build 20.8-b03-424, mixed mode)

The system directory doesn't have the 1.7.

enter image description here

What's wrong with this?

  • Where is the Java 1.7 is installed?
  • How can I make the Java 1.7 as default Java?
share|improve this question
add comment

1 Answer 1

up vote 0 down vote accepted

I found Java 1.7 SDK in /Library/Java/JavaVirtualMachines/jdk1.7.0_07.jdk, and all the binaries in /Library/Java/JavaVirtualMachines/jdk1.7.0_07.jdk/Contents/Home/bin.

enter image description here

And by clicking the jdk file, I could arrange the order so that Java SE 7 is executed first.

java -version
java version "1.7.0_07"
Java(TM) SE Runtime Environment (build 1.7.0_07-b10)
Java HotSpot(TM) 64-Bit Server VM (build 23.3-b01, mixed mode)

And I could also bring up the app from /Applications/Utilities/Java Preferences.app

enter image description here

For eclipse, I could add one line in /Applications/eclipse/Eclipse.app/Contents/MacOS/eclipse.ini to teach eclipse what Java it will use :

-vm
/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/bin/java
share|improve this answer
    
You really didn't give anyone much time to provide an answer eh? Good to know though –  Stu Wilson Sep 12 '12 at 6:08
    
This answer is great if you have the JDK installed. But what if you only have the JRE installed? Nothing shows up in /Library/Java/JavaVirtualMachines. –  james.garriss Apr 24 '13 at 1:08
add comment

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.