debian系linux配置oracel-java8/9

# 安装插件

sudo apt-get install python-software-properties

sudo apt-get install software-properties-common 
sudo apt-get update
# 添加源
sudo apt-add-repository ppa:webupd8team/java
sudo apt-add-repository ‘deb http://ppa.lanchpad.net/webupd8team/java/ubuntu xenial main’
sudo apt-get update
# 安装
sudo apt-get install oracle-java8-installer
sudo apt-get install oracle-java9-installer
sudo apt-get install oracle-java9-set-default
# 配置默认Java
sudo update-alternatives –config java
# 验证
java -version
# 手动安装环境
#set oracle jdk environment
export JAVA_HOME=/usr/lib/jvm/jdk1.7.0_60  ## 这里要注意目录要换成自己解压的jdk 目录
export JRE_HOME=${JAVA_HOME}/jre  
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib  
export PATH=${JAVA_HOME}/bin:$PATH

# APT安装
su -
echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main" | tee /etc/apt/sources.list.d/webupd8team-java.list
echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main" | tee -a /etc/apt/sources.list.d/webupd8team-java.list
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886
apt-get update
apt-get install oracle-java8-installer
exit

发表评论