Mac OS X 10.6.7 Java Path 当前 JDK 令人困惑 [英] Mac OS X 10.6.7 Java Path Current JDK confusing

查看:29
本文介绍了Mac OS X 10.6.7 Java Path 当前 JDK 令人困惑的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法理解 Mac OSX 上多个 Java 版本的(实际路径与链接).通常在 Windows 中,如果我的机器上安装了多个版本,我可以选择我想要的任何版本的路径并使用它.但是在 MAC OS X 中,我明白有一种叫做链接的东西指向 CurrentJDK,如果我想使用不同的版本,我需要将链接更改为 CurrentJdk,对吗?但是让我感到困惑的是,正如您在下面看到的那样,我的所有版本都指向同一个 CurrentJDK,这意味着所有版本都指向当前版本吗?我原以为只有其中一个会指向 CurrentJDK,我可以将其更改为我需要的任何一个,而这里的情况并非如此.我只需要知道如何找到每个版本的 bin(Commands) 文件夹路径,以便我可以使用它来指向 CurrentJDK?还告诉我如何更改指向 CurrentJDK 的链接.

I have trouble understanding (actual paths vs links) for multiple java versions on my Mac OSX. Normally in windows if I have multiple versions installed in my machine, I can just take the path of which ever version I want and use it. But in MAC OS X I undertand that there is something called links that is being pointed to CurrentJDK, and if I want to use a different version I will need to change the link to CurrentJdk right? But what is confusing for me is that as you can see below all my versions are pointing to the same CurrentJDK which means all versions point to current version? I was expecting only one of them would be pointing to CurrentJDK and I could just change it to which ever one I need which is not the case here. All I need to know is how to find the bin(Commands) folder path for each version, so that I can just use it to point to CurrentJDK? Also tell me how to change the link to CurrentJDK.

$ java -version

java version "1.6.0_24"
Java(TM) SE Runtime Environment (build 1.6.0_24-b07-334-10M3326)
Java HotSpot(TM) 64-Bit Server VM (build 19.1-b02-334, mixed mode)

$ pwd

/System/Library/Frameworks/JavaVM.framework/Versions


$ ls -l

lrwxr-xr-x   1 root  wheel    5 Mar 20 11:12 1.3 -> 1.3.1
drwxr-xr-x   3 root  wheel  102 Dec  2  2009 1.3.1
lrwxr-xr-x   1 root  wheel   10 Mar 20 11:12 1.4 -> CurrentJDK
lrwxr-xr-x   1 root  wheel   10 Mar 20 11:12 1.4.2 -> CurrentJDK
lrwxr-xr-x   1 root  wheel   10 Mar 20 11:12 1.5 -> CurrentJDK
lrwxr-xr-x   1 root  wheel   10 Mar 20 11:12 1.5.0 -> CurrentJDK
lrwxr-xr-x   1 root  wheel   10 Mar 20 11:12 1.6 -> CurrentJDK
lrwxr-xr-x   1 root  wheel   10 Mar 20 11:12 1.6.0 -> CurrentJDK
drwxr-xr-x  10 root  wheel  340 Mar 20 11:13 A
lrwxr-xr-x   1 root  wheel    1 Mar 20 11:12 Current -> A
lrwxr-xr-x   1 root  wheel   59 Mar 20 11:12 CurrentJDK -> /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents

推荐答案

很可能你只安装了一个 jdk,因此所有的软链接都指向同一个 jdk.但是,如果您确实安装了多个 jdks,则需要在/Application/Utilities 中的Java 首选项"应用中选择要使用哪一个.

Most possibly you only have one jdk installed, thus all the soft links points to the same jdk. If you however did have multiple jdks installed you would need to choose which one to use with the 'Java Preferences' app in your /Application/Utilities.

顺便说一下,软链接是通过终端中的 ln -s 命令创建的.

Soft links are by the way created with the ln -s command from Terminal.

这篇关于Mac OS X 10.6.7 Java Path 当前 JDK 令人困惑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆