1

我已经在 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)

如何做到这一点?

4

2 回答 2

8

安装你需要的版本,

# 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

于 2016-09-08T18:00:47.860 回答
0

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

于 2016-01-31T09:32:27.750 回答