gpt4 book ai didi

java - linux 中的 update-alternatives 命令是什么,它有什么用?

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:45:34 24 4
gpt4 key购买 nike

在 Linux 中安装 java 时,有一些 update-alternatives 命令的用法,因为我是 Linux 环境的新手,我想知道这个命令的作用以及它的用途

>>sudo update-alternatives --install /usr/bin/java java /usr/lib/java/JDk.../bin/java

最佳答案

基本上它告诉您的机器使用 Jave JDK 的这个替代品而不是默认的 Jave JDK,在 Linux 系统中,默认的是 OpenJDK。

手册页的简短摘录比我能写的任何答案都要好:

update-alternatives creates, removes, maintains and displays information about the symbolic links comprising the Debian alternatives system.

It is possible for several programs fulfilling the same or similar functions to be installed on a single system at the same time. For example, many systems have several text editors installed at once. This gives choice to the users of a system, allowing each to use a different editor, if desired, but makes it difficult for a program to make a good choice for an editor to invoke if the user has not specified a particular preference.

Debian's alternatives system aims to solve this problem. A generic name in the filesystem is shared by all files providing interchangeable functionality. The alternatives system and the system administrator together determine which actual file is referenced by this generic name. For example, if the text editors ed(1) and nvi(1) are both installed on the system, the alternatives system will cause the generic name /usr/bin/editor to refer to /usr/bin/nvi by default. The system administrator can override this and cause it to refer to /usr/bin/ed instead, and the alternatives system will not alter this setting until explicitly requested to do so.

使用 --install 你指定了一个链接、“/usr/bin/java”、一个名称“java”和一个路径“/usr/lib/java/JDK....”,然后你添加了一组替代方案系统。 link 是主链接的通用名称,name 是替代目录中其符号链接(symbolic link)的名称,path 是为主链接引入的替代项。

我希望足够清楚,这里有一个post regarding java alternatives .

对于完整的用法列表,我建议查看相同的手册页,在您的操作系统外壳上键入 man update-alternatives;

关于java - linux 中的 update-alternatives 命令是什么,它有什么用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46890723/

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