Now you have to setup the alternatives so you can use switch
between Iced Tea, which is default, and the Oracle Java.
First install the alternative:
sudo /usr/sbin/update-alternatives
--install "/usr/bin/java" "java" "/usr/java/jdk1.7.0_01/bin/java"
40
Now install the alternative for your browser plugin:
sudo /usr/sbin/update-alternatives --install
"/usr/lib/browser-plugins/javaplugin.so" "javaplugin"
"/usr/java/jdk1.7.0_01/jre/lib/i386/libnpjp2.so" 40
Note: the first quotes are pointing to the path, the the name of
the alternative script, and the 3rd is the location to point to.
The numbers at the end is the priority in case it was set to
automode.
Now you have to configure the alternatives, first we’ll do
java:
sudo /usr/sbin/update-alternatives
java (这里有报错 )
根据openSUSE的官网提示:
在多个版本的 JAVA JRE 或 JDK 中转换
目前 JAVA 软件包使用 update-alternatives 命令。
root 权限执行:
update-alternatives --config java
把所有 JRE 相关链接指向一个 JRE 版本,然后
update-alternatives --config javac
把所有 JDK 相关链接指向一个 JDK 版本
这个命令会列出安装的所有 JRE/JDK 版本便于你控制。
使用:
linux-2szk:/usr/lib/jvm
# sudo /usr/sbin/update-alternatives javapluginupdate-alternatives:
error: unknown argument `javaplugin'
linux-2szk:/usr/lib/jvm
# update-alternatives --config java
There
are 2 choices for the alternative java (providing
/usr/bin/java).
Selection Path Priority Status
------------------------------------------------------------
*
0 /usr/lib/jvm/jre-1.6.0-openjdk/bin/java 17105 auto mode
1 /usr/java/jdk1.7.0_01/bin/java 40 manual mode
2 /usr/lib/jvm/jre-1.6.0-openjdk/bin/java 17105 manual mode
Press
enter to keep the current choice[*], or type selection number:
1
update-alternatives:
using /usr/java/jdk1.7.0_01/bin/java to provide /usr/bin/java
(java) in manual mode.
linux-2szk:/usr/lib/jvm #
java -version
java version
"1.7.0_01"
Java(TM) SE Runtime
Environment (build 1.7.0_01-b08)
Java HotSpot(TM) Server VM
(build 21.1-b02, mixed mode)
Choose the number associated with /usr/java/jdk1.7.0_01/bin/java,
in my case it was 1.
Now lets configure javaplugin:
sudo /usr/sbin/update-alternatives javaplugin
Choose the number associated with
/usr/java/jdk1.7.0_01/jre/lib/i386/libnpjp2.so, in my case it was
1.