CentOS 安装JDK8
若之前自己装过,先卸载rpm安装的jdk版本
1.查看安装的jdk:
#rpm -qa|grep jdk
看到如下信息:
jdk-1.6.0_22-fcs
卸载:
#rpm -e --nodeps jdk-1.6.0_22-fcs
2.下载jdk-8u45-linux-x64.rpm
https://pan.baidu.com/s/1imwCC4rljWwP19AWUJgDLQ
3.命令安装
rpm -ivh jdk-8u45-linux-x64.rpm
4.设置环境变量(.bash_profile 文件)
#set java environment
export JAVA_HOME=/usr/java/jdk1.8.0_45
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin
export JAVA_HOME CLASSPATH PATH
5.检查是否安装成功
java -version
输出一下信息:
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)