CentOS中文网

CentOS 7.2 安装jdk1.8

CentOS中文网 https://www.centos.net.cn 2017-04-11 02:11 出处:网络 编辑:@iCMS
[html]viewplaincopy print? 1.下载jdk1.8安装包 [html]viewplaincopy print? wget--no-check-certificate--no-cookies--header"Cookie:oraclelicense=accept-securebackup-cookie"http://download.or

[html]view plaincopy

print?

CentOS 7.2 安装jdk1.8

1.下载jdk 1.8安装包

[html]view plaincopy

print?

CentOS 7.2 安装jdk1.8

wget--no-check-certificate--no-cookies--header"Cookie:oraclelicense=accept-securebackup-cookie"http://download.oracle.com/otn-pub/java/jdk/8u91-b14/jdk-8u91-linux-x64.tar.gz


2.解压到指定文件夹

[html]view plaincopy

print?

CentOS 7.2 安装jdk1.8

tar-zxvffile-C/usr/local/jdk1.8


3.修改环境变量

打开/etc/profile


[html]view plaincopy

print?

CentOS 7.2 安装jdk1.8

vi/etc/profile


在最后面添加如下内容:


[html]view plaincopy

print?

CentOS 7.2 安装jdk1.8

JAVA_HOME=/usr/local/jdk1.8

JRE_HOME=/usr/local/jdk1.8/jre

CLASSPATH=.:$JRE_HOME/lib:$JAVA_HOME/lib/tools.jar

PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH

exportJAVA_HOMECLASSPATHPATHJRE_HOME


让系统重新加载该文件


[html]view plaincopy

print?

CentOS 7.2 安装jdk1.8

source/etc/profile


4.测试

[html]view plaincopy

print?

CentOS 7.2 安装jdk1.8

java-version


0

精彩评论

暂无评论...
验证码 换一张
取 消