#!/bin/bash
if [ ! -d /home/tools/ ];then
mkdir -p /home/tools
else
rm -rf /home/tools && mkdir -p /home/tools
fi
cd /home/tools && wget http://download.java.com/schema/jdk-8u171-linux-x64.rpm
if [ $? -eq 0 ];then
rpm -ivh jdk-8u171-linux-x64.rpm
else
exit 1
fi
##Edit Jdk Env
cat > /etc/profile.d/java.sh <<EOF
export JAVA_HOME=/usr/java/default/
export PATH=\$PATH:\$JAVA_HOME/bin
EOF
#do source
source /etc/profile.d/java.sh
网友评论