- JDK1.8一键安装脚本
wget https://b2.999797.xyz/jdk8.sh && chmod a+rx jdk8.sh && ./jdk8.sh
- 下载JDK1.8安装包
wget https://b2.999797.xyz/jdk-8u361-linux-x64.tar.gz
- 解压jdk压缩包
tar -zxvf jdk-8u361-linux-x64.tar.gz
- 移动到/usr/local目录下
mv jdk1.8.0_361 /usr/local/
- 配置环境变量
nano /etc/profile
将下面内容粘贴到末尾
export JAVA_HOME=/usr/local/jdk1.8.0_361
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
- 保存修改
source /etc/profile
- 验证安装
java -version
正文完