脚本
#安装java#!/bin/bashif type -p java; thenecho "Java has been installed."else#2.Installed Java , must install wgetwget -c https://repo.huaweicloud.com/java/jdk/8u151-b12/jdk-8u151-linux-arm64-vfp-hflt.tar.gz;tar -zxvf ./jdk-8u151-linux-arm64-vfp-hflt.tar.gz -C /usr/local/;mv /usr/local/jdk1.8.0_151 /usr/local/javaJDK;#3.Configure environment variablesecho "JAVA_HOME=/usr/local/javaJDK" >> /etc/profilesource /etc/profileecho "PATH=${JAVA_HOME}/bin:${PATH}CLASSPATH=${JAVA_HOME}/jre/lib/ext:${JAVA_HOME}/lib/tools.jarexport PATH JAVA_HOME CLASSPATH" >> /etc/profilesource /etc/profileecho "setting path successful."java -versionecho "installed successful."fi
java -version