JDK版本(jdk1.7.0_21和jdk1.7.0_55)
root@xxx-xxx:/usr/lib/jvm# ll
drwxr-xr-x 6 root root 4096 Apr 4 2013 jdk1.7.0_21/
drwxr-xr-x 8 root root 4096 Mar 18 09:04 jdk1.7.0_55/
安装和配置如下。
jdk1.7.0_21
update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.7.0_21/bin/java" 1
update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.7.0_21/bin/javac" 1
update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jdk1.7.0_21/bin/javaws" 1
sudo chmod a+x /usr/bin/java
sudo chmod a+x /usr/bin/javac
sudo chmod a+x /usr/bin/javaws
sudo chown -R root:root /usr/lib/jvm/jdk1.7.0_21
jdk1.7.0_55
update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.7.0_55/bin/java" 1
update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.7.0_55/bin/javac" 1
update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jdk1.7.0_55/bin/javaws" 1
sudo chmod a+x /usr/bin/java
sudo chmod a+x /usr/bin/javac
sudo chmod a+x /usr/bin/javaws
sudo chown -R root:root /usr/lib/jvm/jdk1.7.0_55
我选择/更改默认JDK
update-alternatives --config java
update-alternatives --config javac
update-alternatives --config javaws
在此之后,如果我java -version
运行jdk1.7.0_55
是默认值,则输出如下所示。
root@xxx-xxx:/usr/lib/jvm# java -version
java version "1.7.0_55"
Java(TM) SE Runtime Environment (build 1.7.0_55-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.55-b03, mixed mode)
但是jdk1.7.0_21
是默认值,它会提供类似
java: error while loading shared libraries:
libjli.so :cannot open shared object file: No such file or directory
如果我发出:找到libjli.so
/usr/lib/jvm/jdk1.7.0_55/jre/lib/amd64/jli/libjli.so
/usr/lib/jvm/jdk1.7.0_55/lib/amd64/jli/libjli.so
所以很明显,虽然我选择jdk1.7.0_21
,但不知怎的,它仍然指向jdk1.7.0_55
试图重命名jdk1.7.0_55
但没有运气。
不确定如何解决这个问题。在此先感谢您的帮助:)
解决方案:: 我的jdk1.7.0_21
已损坏,在/usr/lib/jvm/
中下载了一个新的副本形式oracle untar。