linux里使用rpm方式安装jdk

一、环境

1.linux版本

[root@localhost ~]# cat /proc/version
Linux version 3.10.0-123.el7.x86_64 (builder@kbuilder.dev.centos.org) (gcc version 4.8.2 20140120 (Red Hat 4.8.2-16) (GCC) ) #1 SMP Mon Jun 30 12:09:22 UTC 2014

2.jdk版本

jdk-8u212-linux-x64.rpm,下载地址: http://www.oracle.com/technetwork/java/javase/downloads/index.html

二、安装

2.1检测是否已安装jdk

[root@localhost ~]# rpm -qa | grep java
python-javapackages-3.4.1-5.el7.noarch
javapackages-tools-3.4.1-5.el7.noarch
java-1.7.0-openjdk-headless-1.7.0.51-2.4.5.5.el7.x86_64
tzdata-java-2014b-1.el7.noarch
java-1.7.0-openjdk-1.7.0.51-2.4.5.5.el7.x86_64

2.2卸载

rpm -e –nodeps python-javapackages-3.4.1-5.el7.noarch
rpm -e –nodeps javapackages-tools-3.4.1-5.el7.noarch
rpm -e –nodeps java-1.7.0-openjdk-headless-1.7.0.51-2.4.5.5.el7.x86_64
rpm -e –nodeps tzdata-java-2014b-1.el7.noarch
rpm -e –nodeps java-1.7.0-openjdk-1.7.0.51-2.4.5.5.el7.x86_64

2.3安装

rpm -ivh jdk-8u212-linux-x64.rpm  

warning: /usr/local/jdk-8u212-linux-x64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
Preparing… ################################# [100%]
Updating / installing…
1:jdk1.8-2000:1.8.0_212-fcs ################################# [100%]
Unpacking JAR files…
tools.jar…
plugin.jar…
javaws.jar…
deploy.jar…
rt.jar…
jsse.jar…
charsets.jar…
localedata.jar…

2.4配置/etc/profile

#java
export JAVA_HOME=/usr/java/default
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

2.5 source /etc/profile

0

发表评论

邮箱地址不会被公开。