安装环境
Linux服务器: Ubuntu 14.04
root@linuxidc:~# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04.4 LTS
Release: 14.04
Codename: trusty
root@linuxidc:~#
下载jdk1.8
Oracle 提供的jdk1.8 有不同的版本,32位 64位,Solaris ,arms系列等 Linux
注意你选择的需要的jdk版本。如果选错版本,将会导致回去的安装失败。这里应该使用的是Linux X64
如何查看linux的平台版本
root@linuxidc:~# uname -m
x86_64
root@linuxidc:~#
安装过程
root@linuxidc:~/download# sudo mkdir /usr/java
root@linuxidc:~/download#
root@linuxidc:~/download#
root@linuxidc:~/download# sudo tar zxvf jdk-8u111-linux-x64.tar.gz -C /usr/java
//添加环境变量
root@linuxidc:~/sudo vi ~/.bashrc
//在文档末尾添加如下代码:
export JAVA_HOME=/usr/java
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
root@linuxidc:~/download#
root@linuxidc:~/download# sudo update-alternatives --install /usr/bin/java java /usr/java/jdk1.8.0_111/bin/java 300
root@linuxidc:~/download#
root@linuxidc:~/download# sudo update-alternatives --install /usr/bin/javac javac /usr/java/jdk1.8.0_111/bin/javac 300
root@linuxidc:~/download#
root@linuxidc:~/download#
root@linuxidc:~/download# sudo update-alternatives --install /usr/bin/jar jar /usr/java/jdk1.8.0_111/bin/jar 300
root@linuxidc:~/download#
root@linuxidc:~/download# sudo update-alternatives --install /usr/bin/javah javah /usr/java/jdk1.8.0_111/bin/javah 300
root@linuxidc:~/download#
// 这里注意usr/java/jdk1.8.0_111 是我解压自己的文件夹
root@linuxidc:~/download# sudo update-alternatives --config java
There is only one alternative in link group java (providing /usr/bin/java): /usr/java/jdk1.8.0_111/bin/java
Nothing to configure.
root@linuxidc:~/download#
root@linuxidc:~/download#
root@linuxidc:~/download# java -version
java version "1.8.0_111"
Java(TM) SE Runtime Environment (build 1.8.0_111-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.111-b14, mixed mode)
root@linuxidc:~/download#
结束
root@linuxidc:~/download# sudo mkdir /usr/java
root@linuxidc:~/download#
root@linuxidc:~/download#
root@linuxidc:~/download# sudo tar zxvf jdk-8u111-linux-x64.tar.gz -C /usr/java
//添加环境变量
root@linuxidc:~/sudo vi ~/.bashrc
//在文档末尾添加如下代码:
export JAVA_HOME=/usr/java
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
root@linuxidc:~/download#
root@linuxidc:~/download# sudo update-alternatives --install /usr/bin/java java /usr/java/jdk1.8.0_111/bin/java 300
root@linuxidc:~/download#
root@linuxidc:~/download# sudo update-alternatives --install /usr/bin/javac javac /usr/java/jdk1.8.0_111/bin/javac 300
root@linuxidc:~/download#
root@linuxidc:~/download#
root@linuxidc:~/download# sudo update-alternatives --install /usr/bin/jar jar /usr/java/jdk1.8.0_111/bin/jar 300
root@linuxidc:~/download#
root@linuxidc:~/download# sudo update-alternatives --install /usr/bin/javah javah /usr/java/jdk1.8.0_111/bin/javah 300
root@linuxidc:~/download#
// 这里注意usr/java/jdk1.8.0_111 是我解压自己的文件夹
root@linuxidc:~/download# sudo update-alternatives --config java
There is only one alternative in link group java (providing /usr/bin/java): /usr/java/jdk1.8.0_111/bin/java
Nothing to configure.
root@linuxidc:~/download#
root@linuxidc:~/download#
root@linuxidc:~/download# java -version
java version "1.8.0_111"
Java(TM) SE Runtime Environment (build 1.8.0_111-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.111-b14, mixed mode)
root@linuxidc:~/download#
Ubuntu 14.04安装JDK1.8.0_25与配置环境变量 http://www.linuxidc.com/Linux/2015-01/112030.htm
CentOS 搭建JDK环境 http://www.linuxidc.com/Linux/2015-06/118879.htm
Ubuntu 14.04安装JDK1.8.0_25与配置环境变量 http://www.linuxidc.com/Linux/2015-01/112030.htm
Ubuntu 14.04 LTS安装Oracle JDK 1.8 http://www.linuxidc.com/Linux/2014-11/109216.htm
CentOS6.3安装JDK和环境配置 http://www.linuxidc.com/Linux/2012-09/70780.htm
Ubuntu 14.04 安装 JDK8 http://www.linuxidc.com/Linux/2014-09/106218.htm
Ubuntu下安装JDK图文解析 http://www.linuxidc.com/Linux/2014-09/107291.htm
Ubuntu 14.04 LTS下安装JDK 1.8 http://www.linuxidc.com/Linux/2016-09/135403.htm
更多Ubuntu相关信息见Ubuntu 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=2
本文永久更新链接地址:http://www.linuxidc.com/Linux/2016-11/137489.htm