java - Centos 7 如何获取 java 的替代列表

标签 java centos centos7

我想获取 java 版本的所有备选方案列表,选择一个并将其设置在脚本中,但选项 --list 没有按预期工作:

alternatives --list java
alternatives version 1.7.4 - Copyright (C) 2001 Red Hat, Inc.
This may be freely redistributed under the terms of the GNU Public License.

usage: alternatives --install <link> <name> <path> <priority>
                    [--initscript <service>]
                    [--family <family>]
                    [--slave <link> <name> <path>]*
       alternatives --remove <name> <path>
       alternatives --auto <name>
       alternatives --config <name>
       alternatives --display <name>
       alternatives --set <name> <path>
       alternatives --list
common options: --verbose --test --help --usage --version --keep-missing
                --altdir <directory> --admindir <directory>

目前我用/etc/alternatives 创建了我自己的列表,但我并不满意。我怎样才能得到像这样的列表:

# alternatives --config java

There are 2 programs which provide 'java'.

  Selection    Command
-----------------------------------------------
 + 1           java-1.7.0-openjdk.x86_64 (/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.191-2.6.15.4.el7_5.x86_64/jre/bin/java)
*  2           java-1.8.0-openjdk.x86_64 (/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.181-3.b13.el7_5.x86_64/jre/bin/java)

最佳答案

看来选项 --list 不带参数,这是手册概要中的一个错误。此外,为了管理我的 Java 版本,我应该尝试环境变量。

(该错误已报告为 https://github.com/fedora-sysv/chkconfig/issues/11 )

关于java - Centos 7 如何获取 java 的替代列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52606848/

相关文章:

java - 如何添加两个图标到swing AbstractAction

java - 简单的Java代码无法编译- “Create class '中的 'java.lang'对象'”

centos - centos imagemagick安装问题

erlang - Centos 6.4 上的 CouchDB 1.3.1

java - Jacoco 测试覆盖率报告显示 0%

java - 全局初始化的 Drools 规则测试

python - CentOS 6.6 yum在哪里安装python?

centos7 - ping : http://google. com:名称或服务在虚拟盒子上的最小 centos 上未知

apache - redirect tomcat在apache中打开80端口后无法访问phpmyadmin

node.js - 无法在我的虚拟服务器上启动新的 wiki.js 安装