Ubuntu下手动安装JDK8

Ubuntu下手动安装JDK8

摘要

Ubuntu下手动安装JDK8

jdk8一键安装

wget -O install-jdk8.sh https://coding.net/u/javacore/p/dev-env-shell/git/raw/master/ubuntu-1404-64-install-jdk8.sh && bash install-jdk8.sh

jdk8下载地址

官网地址
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

百度网盘 jdk8 linux x64
http://pan.baidu.com/s/1o7MF60y

ubuntu系统

ubuntu x64 14.04

解压配置


#解压
sudo mkdir -p /usr/lib/jvm/
sudo tar zxvf jdk-8u91-linux-x64.tar.gz -C /usr/lib/jvm/

#配置环境变量
sudo vi  /etc/profile

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

#立即生效
 . /etc/profile

设置默认jdk

sudo  update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.8.0_91/bin/java 300
sudo  update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.8.0_91/bin/javac 300
sudo  update-alternatives --config java   
sudo  update-alternatives --config javac

javac