在尝试更改Java版本时,OSX上的符号链接搞砸了

时间:2013-04-05 23:55:36

标签: java macos symlink

我做了一件坏事,请帮忙。

我在:

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

我被告知要运行以下命令:

sudo ln -fhsv 1.6 CurrentJDK

这让一切搞得一团糟:

lrwxr-xr-x   1 root  wheel   10  5 Apr 20:57 1.4 -> CurrentJDK
lrwxr-xr-x   1 root  wheel   10  5 Apr 20:57 1.4.2 -> CurrentJDK
lrwxr-xr-x   1 root  wheel   10  5 Apr 20:57 1.5 -> CurrentJDK
lrwxr-xr-x   1 root  wheel   10  5 Apr 20:57 1.5.0 -> CurrentJDK
lrwxr-xr-x   1 root  wheel   10  5 Apr 20:57 1.6 -> CurrentJDK
lrwxr-xr-x   1 root  wheel   10  5 Apr 20:57 1.6.0 -> CurrentJDK
drwxr-xr-x   8 root  wheel  272  5 Apr 20:57 A
lrwxr-xr-x   1 root  wheel    1  5 Apr 20:57 Current -> A
lrwxr-xr-x   1 root  wheel    3  6 Apr 00:22 CurrentJDK -> 1.6

如何将其恢复为1.6不是符号链接?这是之前的目录。

1 个答案:

答案 0 :(得分:2)

我的目录如下所示:

$ ls -l /System/Library/Frameworks/JavaVM.framework/Versions
total 64
lrwxr-xr-x  1 root  wheel   10 Mar 11 20:37 1.4 -> CurrentJDK
lrwxr-xr-x  1 root  wheel   10 Mar 11 20:37 1.4.2 -> CurrentJDK
lrwxr-xr-x  1 root  wheel   10 Mar 11 20:37 1.5 -> CurrentJDK
lrwxr-xr-x  1 root  wheel   10 Mar 11 20:37 1.5.0 -> CurrentJDK
lrwxr-xr-x  1 root  wheel   10 Mar 11 20:37 1.6 -> CurrentJDK
lrwxr-xr-x  1 root  wheel   10 Mar 11 20:37 1.6.0 -> CurrentJDK
drwxr-xr-x  8 root  wheel  272 Mar 11 20:37 A
lrwxr-xr-x  1 root  wheel    1 Mar 11 20:37 Current -> A
lrwxr-xr-x  1 root  wheel   59 Mar 11 20:37 CurrentJDK -> /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents

这样做:

sudo -s
cd /System/Library/Frameworks/JavaVM.framework/Versions
ln -sf /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents 1.6