#!/bin/bash
echo "安装jdk1.8-472,按任意键继续"
read -n1
yum -y install wget
yum -y install unzip
rpm -e --nodeps jdk1.8-1.8.0_221-fcs.x86_64
mkdir -p /data/software
cd /data/software
curl -O http://down.yadeaiot.net:8000/jdk8u472-b08.zip
unzip jdk8u472-b08.zip
mv jdk8u472-b08 /usr/local/
sudo sed -i '\|JAVA_HOME=/usr/java/jdk1.8.0_221-amd64|d; \|PATH=$JAVA_HOME/bin:$PATH|d' /etc/profile
echo '#set java environment
JAVA_HOME=/usr/local/jdk8u472-b08
PATH=$JAVA_HOME/bin:$PATH
CLASSPATH=$JAVA_HOME/jre/lib/ext:$JAVA_HOME/lib/toos.jar
export JAVA_HOME CLASSPATH PATH' >>/etc/profile
source /etc/profile
java -version
source /etc/profile
java -version
