Centos7下安装jdk
2019-06-06 本文已影响0人
Cingjin
1.打开url选择jdk下载
https://www.oracle.com/technetwork/java/javase/downloads/jdk12-downloads-5295953.html
-w574wget https://download.oracle.com/otn-pub/java/jdk/12.0.1+12/69cfe15208a647278a19ef0990eea691/jdk-12.0.1_linux-x64_bin.tar.gz?AuthParam=1556013255_702a6e00488c9b89fd483a67a0bcf316(地址以最新地址为准)看下面
-w538
2.jdk下载完成后进行处理
命令看包大小是否一致
ls -lht
下载后文件名格式太长需要裁剪
mv jdk-12.0.1_linux-x64_bin.tar.gz?AuthParam=1556013255_702a6e00488c9b89fd483a67a0bcf316 jdk-12.0.1_linux-x64_bin.tar.gz
-w784
3.安装
(1)创建安装目录
mkdir /usr/local/java/
(2)解压至安装目录
tar -zxvf jdk-8u171-linux-x64.tar.gz -C /usr/local/java/
4.设置环境标量
(1)打开文件
vim /etc/profile
(2)在末尾添加
export JAVA_HOME=/usr/local/java/jdk-12.0.1
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
(3)使环境变量生效
source /etc/profile
(4)添加软链接
ln -s /usr/local/java/jdk-12.0.1/bin/java /usr/bin/java
5.检查
java -version
-w758