gpt4 book ai didi

java - 尝试更改 Java 版本时,OSX 上的符号链接(symbolic link)困惑

转载 作者:行者123 更新时间:2023-11-30 04:26:04 25 4
gpt4 key购买 nike

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

我当时在:

/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 不再是符号链接(symbolic link)?这是之前的一个目录。

最佳答案

我的目录如下所示:

$ 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

关于java - 尝试更改 Java 版本时,OSX 上的符号链接(symbolic link)困惑,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15845411/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com