linux 阿里云 新机器 安装jdk1.8

2019年7月17日15:58:34

按着顺序来:

wget https://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.tar.gz?AuthParam=1563350137_da211bb30066c95451752ac56193a05c
下载好解压
tar -zxvf jdk-8u131-linux-x64.tar.gz\?AuthParam\=1563350137_da211bb30066c95451752ac56193a05c
建个文件夹
mkdir /usr/local/java
移动文件夹里面的东西到目录
mv jdk1.8.0_131 /usr/local/java/

cd jdk1.8.0_131/
mv * ../
rm -rf jdk1.8.0_131/
ls
vim /etc/profile
增加如下:

  

export JAVA_HOME=/usr/local/java/
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib:$CLASSPATH
export JAVA_PATH=${JAVA_HOME}/bin:${JRE_HOME}/bin
export PATH=$PATH:${JAVA_PATH}

source /etc/profile
javac
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)
echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/usr/local/java//bin:/usr/local/java//jre/bin

  完事!

posted on 2019-07-17 16:05  山高似水深  阅读(2113)  评论(0编辑  收藏  举报

购买方式 点击下面图标购买