Finally found the answer here:
http://www.adam-bien.com/roller/abien/entry/java_se_development_kit_7
You should use JAVA_HOME=$(/usr/libexec/java_home)
instead on a Mac and then set the current jdk via "Java Preferences.app".
Set JAVA_HOME in ~/.profile
The problem is that the symbolic link "CurrentJDK" inside the versions of JavaVm.framework points to the old jdk, so when i used the following commands to set the CurrentJDK to the latest one (1.7.0_45) it works
cd /System/Library/Frameworks/JavaVM.framework/Versions
sudo rm CurrentJDK
sudo ln -s /Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents CurrentJDK
reference: http://java.dzone.com/articles/installing-jdk-7-mac-os-x
To find the path from Java Preferences, try
/usr/libexec/java_home -X
My Java7 entry looks like this:
<dict>
<key>JVMArch</key>
<string>x86_64</string>
<key>JVMBundleID</key>
<string>com.oracle.java.7u04.jdk</string>
<key>JVMEnabled</key>
<true/>
<key>JVMHomePath</key>
<string>/Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home</string>
<key>JVMIsBuiltIn</key>
<false/>
<key>JVMName</key>
<string>Java SE 7</string>
<key>JVMPlatformVersion</key>
<string>1.7</string>
<key>JVMVendor</key>
<string>Oracle Corporation</string>
<key>JVMVersion</key>
<string>1.7.0_04</string>
</dict>
You need to change the JAVA_HOME
environment variable to the new JDK 1.7 location.
Look at this question for possible locations where JAVA_HOME might be defined. In a terminal, type which java
to find the path of your Java installation, and then update JAVA_HOME
to point to that path (but exclude the trailing bin folder).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With