简体   繁体   English

编辑Java JDK的替代项时权限被拒绝

[英]Permission Denied when editing alternatives for java jdk

So, On CentOS 7 via putty I'm trying to update my Java as it is currently 1.6.0. 因此,在CentOS 7上通过腻子,我正在尝试更新Java,因为它目前是1.6.0。

I have installed the correct JDK however I now have to edit the alternatives and when attempting to do so I receive this: 我已经安装了正确的JDK,但是现在我必须编辑替代方法,并且在尝试这样做时收到以下信息:

[mcserver@e3-1240v3 ~]$ alternatives --config java

There are 5 programs which provide 'java'.

Selection    Command
-----------------------------------------------
+ 1           /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java
  2           /opt/jdk1.8.0_171/bin/java
* 3           /usr/java/jdk-10.0.1/bin/java
  4           /usr/java/jre-10.0.1/bin/java
  5           /usr/java/jdk1.8.0_172-amd64/jre/bin/java

Enter to keep the current selection[+], or type selection number: 3
failed to create /var/lib/alternatives/java.new: Permission denied

Any solutions? 有什么办法吗? Thanks in advance. 提前致谢。

您需要对sudo执行sudo ,或更改/var/lib/alternatives目录的权限( chmod ),如果不存在则最终创建该目录

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM