ubuntu16上安装java8的脚本

官网下载:https://www.oracle.com/java/technologies/javase/javase-jdk8-downloads.html

sudo tar -xvzf jdk-8u271-linux-x64.tar.gz

sudo mkdir /opt/jvm && sudo mv jdk1.8.0_271 /opt/jvm/jdk1.8.0_271

sudo vi ~/.bashrc

 

export JAVA_HOME=/opt/jvm/jdk1.8.0_271
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH

source ~/.bashrc

验证是否安装成功

java -version

posted @ 2020-12-17 23:51  meetrice  阅读(72)  评论(0编辑  收藏  举报