を使用してすべてのJava関連の代替をすばやく切り替える方法はありupdate-alternatives
ますか?
たとえばsudo update-alternatives --config java
、Javaを7に切り替える場合は、Java 7 OpenJdk を実行して選択します。しかし、私が実行するupdate-alternatives --get-selections | grep java
と、次のようになります、
appletviewer auto /usr/lib/jvm/java-6-openjdk-amd64/bin/appletviewer
extcheck auto /usr/lib/jvm/java-6-openjdk-amd64/bin/extcheck
idlj auto /usr/lib/jvm/java-6-openjdk-amd64/bin/idlj
itweb-settings auto /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/itweb-settings
jar auto /usr/lib/jvm/java-6-openjdk-amd64/bin/jar
jarsigner auto /usr/lib/jvm/java-6-openjdk-amd64/bin/jarsigner
java manual /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java
javac auto /usr/lib/jvm/java-6-openjdk-amd64/bin/javac
javadoc auto /usr/lib/jvm/java-6-openjdk-amd64/bin/javadoc
javah auto /usr/lib/jvm/java-6-openjdk-amd64/bin/javah
javap auto /usr/lib/jvm/java-6-openjdk-amd64/bin/javap
javaws auto /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/javaws
jconsole auto /usr/lib/jvm/java-6-openjdk-amd64/bin/jconsole
jdb auto /usr/lib/jvm/java-6-openjdk-amd64/bin/jdb
jexec auto /usr/lib/jvm/java-6-openjdk-amd64/jre/lib/jexec
jhat auto /usr/lib/jvm/java-6-openjdk-amd64/bin/jhat
jinfo auto /usr/lib/jvm/java-6-openjdk-amd64/bin/jinfo
jmap auto /usr/lib/jvm/java-6-openjdk-amd64/bin/jmap
jps auto /usr/lib/jvm/java-6-openjdk-amd64/bin/jps
jrunscript auto /usr/lib/jvm/java-6-openjdk-amd64/bin/jrunscript
jsadebugd auto /usr/lib/jvm/java-6-openjdk-amd64/bin/jsadebugd
jstack auto /usr/lib/jvm/java-6-openjdk-amd64/bin/jstack
jstat auto /usr/lib/jvm/java-6-openjdk-amd64/bin/jstat
jstatd auto /usr/lib/jvm/java-6-openjdk-amd64/bin/jstatd
keytool auto /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/keytool
native2ascii auto /usr/lib/jvm/java-6-openjdk-amd64/bin/native2ascii
orbd auto /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/orbd
pack200 auto /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/pack200
policytool auto /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/policytool
rmic auto /usr/lib/jvm/java-6-openjdk-amd64/bin/rmic
rmid auto /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/rmid
rmiregistry auto /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/rmiregistry
schemagen auto /usr/lib/jvm/java-6-openjdk-amd64/bin/schemagen
serialver auto /usr/lib/jvm/java-6-openjdk-amd64/bin/serialver
servertool auto /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/servertool
tnameserv auto /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/tnameserv
unpack200 auto /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/unpack200
wsgen auto /usr/lib/jvm/java-6-openjdk-amd64/bin/wsgen
wsimport auto /usr/lib/jvm/java-6-openjdk-amd64/bin/wsimport
xjc auto /usr/lib/jvm/java-6-openjdk-amd64/bin/xjc
ご覧のとおり、私のJavaの代替は7に切り替えられましたが、OpenJDK 6に基づく他のすべての代替は切り替えられませんでした。もちろん、それぞれを手動で切り替えるか、スクリプトを作成して切り替えることができますが、これを実現するためのより良い方法があると思います。
update-java-alternatives
プラグイン設定がエラーをスローした場合でも、他のすべてのJavaの代替を変更します。