去官网下载jdk:http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
解压到安装目录
[root@bogonsoftware]# tar -zxvf jdk-8u181-linux-x64.tar.gz -C /usr/local/java/
1
安装完毕之后在/etc/profile文件末尾添加
[root@bogon software]# vi /etc/profile
export JAVA_HOME=/usr/local/java/jdk1.8.0_181
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
使/etc/profile生效
[root@bogonjdk1.8.0_101]# source /etc/profile
${JAVA_HOME}/lib:${JRE_HOME}/libexportPATH=${JAVA_HOME}/bin:$PATH
网友评论