ubuntu 14.10 安装 JDK
http://www.cnblogs.com/0616--ataozhijia/p/4122121.html
http://jingyan.baidu.com/article/eb9f7b6d8f82a6869364e8a7.html
http://persevere.iteye.com/blog/1479524
1、解压文件
sudo mkdir -p /usr/lib/jvm/
sudo tar zxvf jdk-8u31-linux-x64.tar.gz -C /usr/lib/jvm
cd /usr/lib/jvm
2、添加环境变量
sudo gedit ~/.bashrc
加入如下内容
export JAVA_HOME=/usr/lib/jvm/jdk1.8.0_31
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
3、配置默认JDK版本
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.8.0_31/bin/java 300
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.8.0_31/bin/javac 300
sudo update-alternatives --install /usr/bin/jar jar /usr/lib/jvm/java/jdk1.8.0_31/jar 300
sudo update-alternatives --install /usr/bin/javah javah /usr/lib/jvm/jdk1.8.0_31/bin/javah 300
sudo update-alternatives --install /usr/bin/javap javap /usr/lib/jvm/jdk1.8.0_31/bin/javap 300
然后执行
sudo update-alternatives --config java
4、测试
java -version
来源:https://www.cnblogs.com/myubuntu/p/4284528.html