1、在/var/local 目录下新建Java文件夹
# mkdir /usr/local/java
2、转入新建文件夹内
# cd /usr/local/java
3、下载
#wget http://................
官网链接:http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
4、解压 安装包
tar xvf jdk-8u131-linux-x64.tar.gz
5、环境变量
# vi /etc/profile ( 点键盘 i 进入插入命令)
export JAVA_HOME=/usr/local/java/jdk1.8.0_131
export JRE_HOME=/usr/local/java/jdk1.8.0_131/jre
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib:$CLASSPATH
export PATH=$JAVA_HOME/bin:$PATH
(填写完后,ESC —— ctrl + : —— wq ——回车)
# source /etc/profile 运行命令,使profile生效
# java -version 检验是否成功
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
(成功!)
网友评论