【centos7.5环境搭建】java8
发布于 3 个月前 作者 qjzd 147 次浏览 来自 码农

下载jdk

jdk8 oracle官网下载地址 http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

wget下载

wget --no-check-certificate -c --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u181-b13/96a7b8442fe848ef90c96a2fad6ed6d1/jdk-8u181-linux-x64.tar.gz

解压安装

sudo mkdir /opt/java
sudo tar -xzvf ./jdk-8u181-linux-x64.tar.gz -C /opt/java

配置环境变量

sudo vim /etc/profile.d/java.sh

# java.sh内容
export JAVA_HOME=/opt/java/jdk1.8.0_181
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:JAVA_HOME/lib:JRE_HOME/lib:${CLASSPATH}
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH

source /etc/profile

查看版本

java -version

参考

https://stackoverflow.com/questions/10268583/downloading-java-jdk-on-linux-via-wget-is-shown-license-page-instead

回到顶部