如何在centos中降级java版本?

时间:2016-01-29 12:46:02

标签: java centos install downgrade javapns

我在Centos 6.7中安装了java版本:

java -version
java version "1.6.0_38"
OpenJDK Runtime Environment (IcedTea6 1.13.10) (rhel-1.13.10.0.el6_7-x86_64)
OpenJDK 64-Bit Server VM (build 23.25-b01, mixed mode)

我想将java版本降级为

java -version
java version "1.6.0_17"
OpenJDK Runtime Environment (IcedTea6 1.7.10) (rhel-1.20.b17.el5-x86_64)
OpenJDK 64-Bit Server VM (build 14.0-b16, mixed mode)

如何实现这一目标?

2 个答案:

答案 0 :(得分:5)

安装所需的版本

# cd /<place you want java installed>/
# wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/<version>/jdk-<version>-linux-x64.tar.gz"

# tar xzf jdk-<version>-linux-x64.tar.gz

使用替代品安装Java,

# cd /<place java install>/jdk1.6.0_17/
# alternatives --install /usr/bin/java java /opt/jdk1.6.0_17/bin/java 2
# alternatives --config java

然后选择想要的版本

There are 2 programs which provide 'java'.

Selection    Command
-----------------------------------------------
* + 1           /opt/jdk1.6.0_38/bin/java
2           /opt/jdk1.6.0_17/bin/java

Enter to keep the current selection[+], or type selection number: 

输入2

答案 1 :(得分:0)

尝试从Java下载中下载并安装特定版本,然后更改Java主路径。