Change java version (MAC)

There are 2 Java versions on my computer:

/Library/Java/JavaVirtualMachines/jdk1.7.0_07.jdk/Contents/Home
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home

1.6. 0 is set as the default How to make my java program run 1.7?

Attempt to add:

export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_07.jdk/Contents/Home

It's mine Zshrc file But this only seems to change the path of Java commands on my terminal

Also try changing the home symbolic link as follows:

cd /Library/Java
mv Home Home-1.6
ln -s /Library/Java/JavaVirtualMachines/jdk1.7.0_07.jdk/Contents/Home/ Home

This has no effect at all

I have also tried Java conversion software: http://www.guigarage.com/2013/02/change-java-version-on-mac-os/ But it didn't work

Know how to launch version 1.7 by clicking on them App and Java programs such as jar files?

Solution

I believe OS X (at least 10.8) uses the following path:

> JRE:/System/Library/Frameworks/JavaVM. framework/Versions/Current > JDK:/System/Library/Frameworks/JavaVM. framework/Versions/CurrentJDK

These are symbolic links that you can update to point to the 1.7 installation

You can verify this quite easily:

a) Run which java to check which Java executable is executing In theory, that should be / usr / bin / Java

b) Run LS - La on the Java executable, which should tell you the location it points to (/ system / library / frameworks / JavaVM. Framework / versions / current / commands / Java on my machine)

I think this should sort you out Jar execution problem If your Java application is wrapped in In app, I think it's a little complicated: if memory service is used, the Java version used will depend on Javaapplicationstab. Used by app

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>