1.打开url选择jdk1.8下载
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html我选择linux x64版本:
2.下载
wget http://download.oracle.com/otn-pub/java/jdk/8u171-b11/512cd62ec5174c3487ac17c61aaa89e8/jdk-8u171-linux-x64.tar.gz?AuthParam=1531155951_4e06a4d17c6c1dbfb8440352e19dd2ae下载以后通过命令检查安装包大小是否符合ls -lht
3.安装(1)创建安装目录mkdir /usr/local/java/
(2)解压至安装目录tar -zxvf jdk-8u171-linux-x64.tar.gz -C /usr/local/java/
4.设置环境变量打开文件vim /etc/profile
在末尾添加export JAVA_HOME=/usr/local/java/jdk1.8.0_171
export JRE_HOME=${JAVA_HOME}/jreexport CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/libexport PATH=${JAVA_HOME}/bin:$PATH使环境变量生效source /etc/profile
添加软链接ln -s /usr/local/java/jdk1.8.0_171/bin/java /usr/bin/java
检查java -version
---------------------
作者:awesome_go 来源:CSDN 原文:https://blog.csdn.net/u013452337/article/details/82589839 版权声明:本文为博主原创文章,转载请附上博文链接!