Redhat Enterprise Linux 6.4 安裝Oracle JDK替換OpenJDK

五柳-先生發表於2015-10-14

省java版本為OpenJDK 1.7:

# java -version

java version "1.7.0_09-icedtea"

OpenJDK Runtime Environment (rhel-2.3.4.1.el6_3-x86_64)
OpenJDK 64-Bit Server VM (build 23.2-b09, mixed mode)
 

# update-alternatives --config java

There are 2 programs which provide 'java'.

  Selection    Command
-----------------------------------------------
*+ 1           /usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/java
   2           /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java


安裝Oracle JDK 1.7:
# rpm -ivh /mnt/hgfs/pub/jdk-7u45-linux-x64.rpm

update-alternatives新增Oracle JDK 1.7:
# update-alternatives --install /usr/bin/java java /usr/java/jdk1.7.0_45/bin/java 1


更改預設JDK版本:
# update-alternatives --config java
There are 3 programs which provide 'java'.

  Selection    Command
-----------------------------------------------
*+ 1           /usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/java
   2           /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java
   3           /usr/java/jdk1.7.0_45/bin/java

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

# java -version
java version "1.7.0_45"
Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)


轉載: http://blog.sina.com.cn/s/blog_71d9aee40101qg03.html

相關文章