alternatives命令用法
alternatives是Linux下的一个功能强大的命令。只能在root权限下执行。如系统中有几个命令功能十分类似,却又不能随意删除,那么可以用 alternatives 来指定一个全局的设置。
alternatives常用于同一个系统中安装同一软件的多个版本。比如为了开发需要,我需要安装JDK1.4.2,同时还需要JDK1.6.10,我怎么样才能忽略安装路径,按照我自己的意思,使用我想要的java版本呢?
下面为您一一道来。
alternatives的命令行执行如下:
[root@localhost tools]# alternatives
alternatives version 1.3.36 - 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>]
[--slave <link> <name> <path>]*
alternatives --remove <name> <path>
alternatives --auto <name>
alternatives --config <name>
alternatives --display <name>
alternatives --set <name> <path>
common options: --verbose --test --help --usage --version
--altdir <directory> --admindir <directory>
说明:
alternatives --install <link> <name> <path> <priority>
其中,
install表示安装
link是符号链接
name则是标识符
path是执行文件的路径
priority则表示优先级
以java的安装为例,我的Fedora 8下自带了两种java版本,分别如下:
Selection Command
-----------------------------------------------
* 1 /usr/lib/jvm/jre-1.7.0-icedtea/bin/java
2 /usr/lib/jvm/jre-1.5.0-gcj/bin/java
我在目录/tools/jdk安装了java version "1.4.2_19"
[root@localhost test]# alternatives --install /usr/bin/java java /tools/jdk/bin/java 3
[root@localhost test]# alternatives --config java
There are 3 programs which provide 'java'.
Selection Command
-----------------------------------------------
*+ 1 /usr/lib/jvm/jre-1.7.0-icedtea/bin/java
2 /usr/lib/jvm/jre-1.5.0-gcj/bin/java
3 /tools/jdk/bin/java
Enter to keep the current selection[+], or type selection number: 3
我还在目录/tools/jdk6下安装了java version "1.6.0_12"
[root@localhost test]# alternatives --install /usr/bin/java java /tools/jdk6/bin/java 4
[root@localhost test]# alternatives --config java
There are 4 programs which provide 'java'.
Selection Command
-----------------------------------------------
* 1 /usr/lib/jvm/jre-1.7.0-icedtea/bin/java
2 /usr/lib/jvm/jre-1.5.0-gcj/bin/java
+ 3 /tools/jdk/bin/java
4 /tools/jdk6/bin/java
Enter to keep the current selection[+], or type selection number: 4
用alternatives --config java就可以选择你想要的Java版本。
分享到:
相关推荐
下面小编就为大家带来一篇使用Linux的alternatives命令替换选择软件的版本方法。小编觉得挺不错的,现在就分享给大家,也给大家做个参考。一起跟随小编过来看看吧
CSS Framework Alternatives 英文epub 本资源转载自网络,如有侵权,请联系上传者或csdn删除 查看此书详细信息请在美国亚马逊官网搜索此书
CSS Framework Alternatives
主要介绍了linux软件版本管理命令update-alternatives使用详解的相关资料,需要的朋友可以参考下
频率选择表面研究的先驱Munk老先生关于超材料研究的一些批判性思考,值得一读
文章资料imaging spectropolarimeter方面的文章
主要介绍了linux使用update-alternatives切换java版本的相关资料,需要的朋友可以参考下
CSS Framework Alternatives 英文无水印原版pdf pdf所有页面使用FoxitReader、PDF-XChangeViewer、SumatraPDF和Firefox测试都可以打开 本资源转载自网络,如有侵权,请联系上传者或csdn删除 查看此书详细信息请...
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 ...
Learn how to use lightweight CSS framework alternatives to build intuitive websites. This book presents five project examples that use Skeleton, Miligram, UI Kit, Material Design Lite and Susy.
在那篇文章中,我们使用 update-alternatives 命令实现从一个 PHP 版本切换到另一个 PHP 版本。也就是说, update-alternatives 命令可以将 系统范围 system wide 默认使用的 PHP 版本设置为我们希望的版本。通俗的...
Debian替代系统的另一种实现
2020年06月CFA三级Flashcard_Alternatives
使用方法,解压到本地目录,配置path,即可在dos下使用linux命令。 windows下能直接执行的linux命令,基本包括日常所有,如:[.exe grolbp.exe regtool.exe a2p.exe grolj4.exe rm.exe a2p5.10.0.exe grops.exe ...
下面按类别列出一些ORACLE用户常用数据字典的查询使用方法。 1、用户 查看当前用户的缺省表空间 SQL>select username,default_tablespace from user_users; 查看当前用户的角色 SQL>select * from user_...
您可以使用beet config --edit命令将替代插件添加到配置中。 plugins : - ... - alternatives 现在,您可以使用以下其中一种用例。 外部档案 假设您喜欢的便携式播放器仅支持MP3和MP4,磁盘空间有限并且安装在/...
这是使用抽象根类实现的,该抽象类具有某种抽象方法和一种最终的具体方法:模板方法。 拟议的替代方案 仅使用将要覆盖的方法将抽象根类重构为接口。 创建一个新的类,即协调器,在其中创建一个包含固定逻辑的方法。...
包中包含jdk-7u80-linux-x64.tar.gz和oracle-java7-jdk_7u80_amd64.deb,其中deb包是使用命令把tar.gz转换生成的,Ubunt18.04无法直接安装openjdk-7-jdk,Oracle官网不好下载,而且网上很多下载的都是tar.gz包,不是...
语言:English 每次打开新标签时,这是一种...如果您想提出新工具的建议,请与我们联系或在Github上使用代码。 此处提供Firefox版本:https://addons.mozilla.org/en-GB/firefox/addon/ethical-product-alternatives/