如何在MacOS中更改CurrentJDK符号链接 [英] How change CurrentJDK symbolic link in MacOS
问题描述
当前在我的Mac中,我具有以下JAVA版本:
Currently in my Mac I have these JAVA versions:
MyMac $ cd/库/Java/JavaVirtualMachines
MyMac$ cd /Library/Java/JavaVirtualMachines
$ ls -la
总计0
drwxr-xr-x 4根轮136 Oct 10:11.
drwxr-xr-x 4 root wheel 136 17 Oct 11:21 .
drwxrwxr-x 5根轮170 Oct 10:11 ..
drwxrwxr-x 5 root wheel 170 17 Oct 11:21 ..
drwxr-xr-x 3根轮102 Jul 07:52 1.6.0.jdk
drwxr-xr-x 3 root wheel 102 14 Jul 22:52 1.6.0.jdk
drwxr-xr-x 3根轮102 Oct 10:11 jdk1.7.0_79.jdk
drwxr-xr-x 3 root wheel 102 17 Oct 11:16 jdk1.7.0_79.jdk
我想做的是更改符号链接以指向JDK 7而不是JDK 6:
What I am trying to do is change the symbolic link to point to JDK 7 instead of JDK 6:
$ cd/System/Library/Frameworks/JavaVM.framework/Versions
$cd /System/Library/Frameworks/JavaVM.framework/Versions
$ ls -la
drwxr-xr-x 11根轮374 10月17日11:21.
drwxr-xr-x 11 root wheel 374 17 Oct 11:21 .
drwxr-xr-x 10根轮340 10月17日11:21 ..
drwxr-xr-x 10 root wheel 340 17 Oct 11:21 ..
lrwxr-xr-x 1根轮10 17 Oct 11:21 1.4-> CurrentJDK
lrwxr-xr-x 1 root wheel 10 17 Oct 11:21 1.4 -> CurrentJDK
lrwxr-xr-x 1根轮10 Oct 10 11:21 1.4.2-> CurrentJDK
lrwxr-xr-x 1 root wheel 10 17 Oct 11:21 1.4.2 -> CurrentJDK
lrwxr-xr-x 1根轮10 17 Oct 11:21 1.5-> CurrentJDK
lrwxr-xr-x 1 root wheel 10 17 Oct 11:21 1.5 -> CurrentJDK
lrwxr-xr-x 1根轮10 Oct 10 11:21 1.5.0-> CurrentJDK
lrwxr-xr-x 1 root wheel 10 17 Oct 11:21 1.5.0 -> CurrentJDK
lrwxr-xr-x 1根轮10 Oct 10 11:21 1.6-> CurrentJDK
lrwxr-xr-x 1 root wheel 10 17 Oct 11:21 1.6 -> CurrentJDK
lrwxr-xr-x 1根轮10 Oct 10 11:21 1.6.0-> CurrentJDK
lrwxr-xr-x 1 root wheel 10 17 Oct 11:21 1.6.0 -> CurrentJDK
drwxr-xr-x 8根轮272 10月17日11:21 A
drwxr-xr-x 8 root wheel 272 17 Oct 11:21 A
lrwxr-xr-x 1根轮1 Oct 10:17当前-> A
lrwxr-xr-x 1 root wheel 1 17 Oct 11:21 Current -> A
lrwxr-xr-x 1根齿轮52 Oct 10:11 CurrentJDK-> /Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents
lrwxr-xr-x 1 root wheel 52 17 Oct 11:21 CurrentJDK -> /Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents
很遗憾,我无法删除该链接.我收到不允许的操作错误:
Unfortunately I cannot remove the link. I am getting an operation not permitted error:
sudo rm CurrentJDK
sudo rm CurrentJDK
rm:CurrentJDK:不允许操作
rm: CurrentJDK: Operation not permitted
有什么想法吗?
谢谢!
推荐答案
El Capitan的新功能:系统完整性保护(SIP)是导致此问题的原因.我必须先禁用SIP.
El Capitan new feature: System Integrity Protection (SIP), was the cause of this problem. I had to disable SIP first.
请按照以下步骤禁用SIP:
Follow these steps to disable SIP:
重新启动Mac. 在OS X启动之前,按住Command-R并按住不放,直到看到Apple图标和进度条.释放.这会引导您进入恢复状态. 从实用工具"菜单中,选择终端". 在提示符下,准确键入以下内容,然后按Return键:
Restart your Mac. Before OS X starts up, hold down Command-R and keep it held down until you see an Apple icon and a progress bar. Release. This boots you into Recovery. From the Utilities menu, select Terminal. At the prompt type exactly the following and then press Return:
csrutil disable
终端应显示一条消息,说明SIP已被禁用.
从苹果菜单中,选择重新启动.
您可以按照上述步骤重新启用SIP,但改用csrutil enable
.
Terminal should display a message that SIP was disabled.
From the apple menu, select Restart.
You can re-enable SIP by following the above steps, but using csrutil enable
instead.
这篇关于如何在MacOS中更改CurrentJDK符号链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!