1. 程式人生 > >centos7 安裝jdk

centos7 安裝jdk

node runt x64 ads acl packages rep .html 是否

安裝方式:rpm安裝,因為可能部分機子不連接外網,所以統一用rpm安裝
軟件:jdk-8u45-linux-x64.rpm

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

查看自帶java信息
[[email protected] ~]# 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信息:
[[email protected]

/* */ ~]# 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,執行以下操作:
[[email protected] ~]# rpm -e --nodeps tzdata-java-2014i-1.el7.noarch
[[email protected]
/* */ ~]# rpm -e --nodeps java-1.7.0-openjdk-headless-1.7.0.71-2.5.3.1.el7_0.x86_64

[[email protected] ~]# 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/執行以下操作:

[[email protected] ~]# cd /usr/local/

[[email protected] local]# rpm -ivh jdk-8u45-linux-x64.rpm

JDK默認安裝在/usr/java中。

執行以下操作,查看信息是否正常:
[[email protected] ~]# java
[[email protected] ~]# javac
[[email protected] ~]# java -version

centos7 安裝jdk