日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

alternatives命令使用方法

發布時間:2023/12/10 编程问答 29 豆豆
生活随笔 收集整理的這篇文章主要介紹了 alternatives命令使用方法 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

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版本號。

總結

以上是生活随笔為你收集整理的alternatives命令使用方法的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。