CentOS7一键安装 java 8 脚本
wget -q https://la.ainsma.ga/ftp/install_java.sh && chmod a+x install_java.sh && ./install_java.sh
注意楼主的VPS已经过期,以下代码只供参考,wget那一行的文件请自行下载
脚本代码如下
# 代码如下
wget https://la.ainsma.ga/ftp/jdk-8u162-linux-x64.tar.gz
rm -rf /usr/local/java
mkdir /usr/local/java
tar -C /usr/local/java -vxzf jdk-8u162-linux-x64.tar.gz
cd /usr/local/java
ln -s jdk1.8.0_162/ jdk
echo export JAVA_HOME=/usr/local/java/jdk >> /etc/profile
echo -e export CLASSPATH=.:\$JAVA_HOME/lib/dt.jar:\$JAVA_HOME/lib/tools.jar >> /etc/profile
echo -e export PATH=\$PATH:\$JAVA_HOME/bin >> /etc/profile
source /etc/profile