您的位置:首页 > 编程语言 > Java开发

Set Java 7 as default JVM on Mac OSX Mountain Lion

2013-08-14 23:09 239 查看
I recently had an issue where an application I wanted to run on Mountain Lion needed Java 7 as the default JVM on the machine. The install for the app in question worked without errors, but the issue was highlighted when trying to run the app.

Here’s how I fixed the problem.

Firstly, open Terminal and find out the current default Java version on your machine:
java -version


Download the Java 7 JDK from the Java SE site (http://www.oracle.com/technetwork/java/javase/downloads/index.html)

Run the installer. Now, for me this still didnt ensure that the updated Java version was the current one used by the system.

In Terminal, navigate to the following location:
cd /System/Library/Frameworks/JavaVM.framework/Versions/


The CurrentJDK symlink in this directory was still pointing to an older Java version. To resolve this, remove the symlink and create a new one pointing to the new Java 7 JDK (you may need to use sudo to run these commands):
rm CurrentJDK

ln -s /Library/Java/JavaVirtualMachines/jdk1.7.0_21.jdk/Contents/ CurrentJDK


This fixed it for me. To confirm, check the Java version once again in Terminal:
java -version


转载地址:http://www.mattgifford.co.uk/set-java-7-as-default-jvm-on-mac-osx-mountain-lion
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: