centos7安装java1.8

安装方式:rpm安装,因为可能部分机子不连接外网,所以统一用rpm安装
软件:jdk-8u45-linux-x64.rpm

下载地址:http://www.oracle.com/technetwork/java/javase/downloads/index.html

 

查看自带java信息
[root@zck ~]# java -version
java version "1.7.0_"
OpenJDK Runtime Environment (IcedTea6 1.11.1) (rhel-1.45.1.11.1.el6-x86_64)
OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)

进一步查看JDK信息:
[root@localhost ~]#  rpm -qa | grep java
javapackages-tools-3.4.1-6.el7_0.noarch
tzdata-java-2014i-1.el7.noarch
java-1.7.0-openjdk-headless-1.7.0.71-2.5.3.1.el7_0.x86_64
java-1.7.0-openjdk-1.7.0.71-2.5.3.1.el7_0.x86_64
python-javapackages-3.4.1-6.el7_0.noarch

卸载OpenJDK,执行以下操作:
[root@localhost ~]# rpm -e –nodeps tzdata-java-2014i-1.el7.noarch
[root@localhost ~]# rpm -e –nodeps java-1.7.0-openjdk-headless-1.7.0.71-2.5.3.1.el7_0.x86_64

[root@localhost ~]# rpm -e –nodeps java-1.7.0-openjdk-1.7.0.71-2.5.3.1.el7_0.x86_64

 

安装JDK

上传新的jdk-8u45-linux-x64.rpm软件到/usr/local/执行以下操作:

[root@localhost ~]# cd /usr/local/

[root@localhost local]# rpm -ivh jdk-8u45-linux-x64.rpm

JDK默认安装在/usr/java中。

 

执行以下操作,查看信息是否正常:
[root@localhost ~]# java
[root@localhost ~]# javac
[root@localhost ~]# java -version

http://www.centoscn.com/image-text/install/2015/0609/5625.html