#!/bin/bash
mkdir ~/Download
cd ~/Download
curl -O https://mirrors.huaweicloud.com/java/jdk/8u152-b16/jdk-8u152-linux-arm32-vfp-hflt.tar.gz
tar -zxvf jdk-8u152-linux-arm32-vfp-hflt.tar.gz
mv jdk1.8.0_152 /opt/
echo 'export JAVA_HOME=/opt/jdk1.8.0_152' >> /etc/profile
echo 'export PATH=${JAVA_HOME}/bin:${PATH}' >> /etc/profile
sleep 5s
source /etc/profile

rm /etc/alternatives/java
ln -s /opt/jdk1.8.0_152/bin/java /etc/alternatives/java