标签:class code java http com os
查看已安装的java
1
[root
@s0
Soft]
# rpm -qa | grep java
2
tzdata-java-2013c-1.el6.noarch
3
java-1.6.0-openjdk-1.6.0.0-1.61.1.11.11.el6_4.x86_64
4
java-1.7.0-openjdk-1.7.0.19-2.3.9.1.el6_4.x86_64
5
libreoffice-javafilter-3.4.5.2-16.1.el6_3.x86_64
6
java_cup-0.10k-5.el6.x86_64
删除已安装的
1
[root
@s0
Soft]
# rpm -e --nodeps tzdata-java-2013c-1.el6.noarch java-1.6.0-openjdk-1.6.0.0-1.61.1.11.11.el6_4.x86_64 java-1.7.0-openjdk-1.7.0.19-2.3.9.1.el6_4.x86_64 libreoffice-javafilter-3.4.5.2-16.1.el6_3.x86_64 java_cup-0.10k-5.el6.x86_64
下载并安装新的JDK(注:axel是个多线程软件)
1
[root
@s0
Soft]
#axel http://download.oracle.com/otn-pub/java/jdk/8-b132/jdk-8-linux-x64.rpm?AuthParam=1395380626_675b0c9264d67806a907228a7af4de9f
2
[0%] .......... .......... .......... .......... .......... [ 0.9MB/s]
3
[100%] .......... .......... .......... .......... .......... [ 28.9MB/s]
4
[100%] .......... ......
5
6
Downloaded 133.9 megabytes in 01:03 seconds. (28.92 MB/s)
7
8
[root
@s0
Soft]
# rpm -ivch jdk-8-linux-x64.rpm
验证安装
1
[root
@s0
Soft]
# java -version
2
java version
"1.8.0"
3
Java(TM) SE Runtime Environment (build 1.8.0-b132)
4
Java HotSpot(TM) 64-Bit Server VM (build 25.0-b70, mixed mode)
配置环境变量(在/etc/profile中追加)
1
[root
@s0
Soft]
# vim + /etc/profile
2
JAVA_HOME=/usr/java/jdk1.8.0
3
JRE_HOME=/usr/java/jdk1.8.0/jre
4
PATH=
$PATH
:
$JAVA_HOME
/bin:
$JRE_HOME
/bin
5
CLASSPATH=.:
$JAVA_HOME
/lib/dt.jar:
$JAVA_HOME
/lib/tools.jar:
$JRE_HOME
/lib
6
export JAVA_HOME JRE_HOME PATH CLASSPATH
使环境变量立即生效
1
[root
@s0
Soft]
# source /etc/profile
2
[root
@s0
Soft]
# echo $PATH
3
/usr/lib64/qt-3.3/bin:/usr/
local
/sbin:/usr/
local
/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/
local
/go/bin:/root/bin:/usr/
local
/go/bin:/usr/java/jdk1.8.0/bin:/usr/java/jdk1.8.0/jre/bin
4
[root
@s0
Soft]
# echo $JAVA_HOME
5
/usr/java/jdk1.8.0
6
[root
@s0
Soft]#
centos6.4安装javajdk1.8,布布扣,bubuko.com
标签:class code java http com os
原文地址:http://www.cnblogs.com/gailuo/p/3807056.html