#!/bin/bash
wget http://192.168.1.159/gj/jdk-8u211-linux-x64.tar.gz
tar xf jdk-8u211-linux-x64.tar.gz -C /usr/local/
cat > /etc/profile.d/jdk8.sh << EOF
export JAVA_HOME=/usr/local/jdk1.8.0_211
export CLASS_PATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/jar/tools.jar:$JAVA_HOME/jre/lib
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/apr/lib
EOF
chmod +x /etc/profile.d/jdk8.sh
source /etc/profile.d/jdk8.sh
java -version