环境:
系统:centos6.8
JDK:1.8 ,rpm tar.gz
jdk8 下载位置
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
安装方法
方法一:手动解压JDK的压缩包,设置环境变量
方法二:yum安装JDK
方法三:用rpm安装JDK
方法一:手动解压JDK的压缩包,设置环境变量
1.创建java目录
[root@centos6-01 ~]# mkdir /usr/java
[root@centos6-01 ~]# cd /usr/java/
2.下载,然后解压,这一步我已经将软件下载并放到/sofwaretar 目录下
拷贝到 /usr/java
[root@centos6-01 java]# cp /softwaretar/jdk-8u111-linux-x64.tar.gz ./
[root@centos6-01 java]# ll
total 177192
-rw-r--r--. 1 root root 181442359 Dec 23 14:04 jdk-8u111-linux-x64.tar.gz
[root@centos6-01 java]# tar -zxvf jdk-8u111-linux-x64.tar.gz
3.设置环境变量
[root@centos6-01 java]# vi /etc/profile
添加如下内容:
#set java environment
JAVA_HOME=/usr/java/jdk1.8.0_111
JRE_HOME=/usr/java/jdk1.8.0_111/JRE
CLASS_PATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib
PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
export JAVA_HOME JRE_HOME CLASS_PATH PATH
生效修改
[root@centos6-01 java]#source /etc/profile
4.验证
[root@centos6-01 java]# 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)
方法二:yum安装JDK
1.查看yum库中有那些jdk版本
[root@centos6-01 java]# yum search java|grep jdk
ldapjdk-javadoc.x86_64 : Javadoc for ldapjdk
java-1.6.0-openjdk.x86_64 : OpenJDK Runtime Environment
java-1.6.0-openjdk-demo.x86_64 : OpenJDK Demos
java-1.6.0-openjdk-devel.x86_64 : OpenJDK Development Environment
java-1.6.0-openjdk-javadoc.x86_64 : OpenJDK API Documentation
java-1.6.0-openjdk-src.x86_64 : OpenJDK Source Bundle
java-1.7.0-openjdk.x86_64 : OpenJDK Runtime Environment
java-1.7.0-openjdk-demo.x86_64 : OpenJDK Demos
java-1.7.0-openjdk-devel.x86_64 : OpenJDK Development Environment
java-1.7.0-openjdk-javadoc.noarch : OpenJDK API Documentation
java-1.7.0-openjdk-src.x86_64 : OpenJDK Source Bundle
java-1.8.0-openjdk.x86_64 : OpenJDK Runtime Environment
java-1.8.0-openjdk-debug.x86_64 : OpenJDK Runtime Environment with full debug on
java-1.8.0-openjdk-demo.x86_64 : OpenJDK Demos
java-1.8.0-openjdk-demo-debug.x86_64 : OpenJDK Demos with full debug on
java-1.8.0-openjdk-devel.x86_64 : OpenJDK Development Environment
java-1.8.0-openjdk-devel-debug.x86_64 : OpenJDK Development Environment with
java-1.8.0-openjdk-headless.x86_64 : OpenJDK Runtime Environment
java-1.8.0-openjdk-headless-debug.x86_64 : OpenJDK Runtime Environment with full
java-1.8.0-openjdk-javadoc.noarch : OpenJDK API Documentation
java-1.8.0-openjdk-javadoc-debug.noarch : OpenJDK API Documentation for packages
java-1.8.0-openjdk-src.x86_64 : OpenJDK Source Bundle
java-1.8.0-openjdk-src-debug.x86_64 : OpenJDK Source Bundle for packages with
ldapjdk.x86_64 : The Mozilla LDAP Java SDK
2.选择版本,进行安装
[root@centos6-01 java]# yum install java-1.8.0-openjdk
3.设置环境变量
[root@centos6-01 java]# vi /etc/profile
添加如下内容:
#set java environment
JAVA_HOME= /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.111-0.b15.el6_8.x86_64/
JRE_HOME= /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.111-0.b15.el6_8.x86_64//JRE
CLASS_PATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib
PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
export JAVA_HOME JRE_HOME CLASS_PATH PATH
生效修改
[root@centos6-01 java]#source /etc/profile
4.验证
[root@centos6-01 java]# 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)
方法三:用rpm安装JDK
1. 下载
已下载软件到/usr/java 目录下
2.使用rpm命令安装
rpm -ivh jdk-8u111-linux-x64.rpm
3.设置环境变量
[root@centos6-01 java]# vi /etc/profile
添加如下内容:
#set java environment
JAVA_HOME=/usr/java/jdk1.8.0_111
JRE_HOME=/usr/java/jdk1.8.0_111/JRE
CLASS_PATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib
PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
export JAVA_HOME JRE_HOME CLASS_PATH PATH
生效修改
[root@centos6-01 java]#source /etc/profile
4.验证
[root@centos6-01 java]# 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)
系统:centos6.8
JDK:1.8 ,rpm tar.gz
jdk8 下载位置
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
安装方法
方法一:手动解压JDK的压缩包,设置环境变量
方法二:yum安装JDK
方法三:用rpm安装JDK
方法一:手动解压JDK的压缩包,设置环境变量
1.创建java目录
[root@centos6-01 ~]# mkdir /usr/java
[root@centos6-01 ~]# cd /usr/java/
2.下载,然后解压,这一步我已经将软件下载并放到/sofwaretar 目录下
拷贝到 /usr/java
[root@centos6-01 java]# cp /softwaretar/jdk-8u111-linux-x64.tar.gz ./
[root@centos6-01 java]# ll
total 177192
-rw-r--r--. 1 root root 181442359 Dec 23 14:04 jdk-8u111-linux-x64.tar.gz
[root@centos6-01 java]# tar -zxvf jdk-8u111-linux-x64.tar.gz
3.设置环境变量
[root@centos6-01 java]# vi /etc/profile
添加如下内容:
#set java environment
JAVA_HOME=/usr/java/jdk1.8.0_111
JRE_HOME=/usr/java/jdk1.8.0_111/JRE
CLASS_PATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib
PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
export JAVA_HOME JRE_HOME CLASS_PATH PATH
生效修改
[root@centos6-01 java]#source /etc/profile
4.验证
[root@centos6-01 java]# 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)
方法二:yum安装JDK
1.查看yum库中有那些jdk版本
[root@centos6-01 java]# yum search java|grep jdk
ldapjdk-javadoc.x86_64 : Javadoc for ldapjdk
java-1.6.0-openjdk.x86_64 : OpenJDK Runtime Environment
java-1.6.0-openjdk-demo.x86_64 : OpenJDK Demos
java-1.6.0-openjdk-devel.x86_64 : OpenJDK Development Environment
java-1.6.0-openjdk-javadoc.x86_64 : OpenJDK API Documentation
java-1.6.0-openjdk-src.x86_64 : OpenJDK Source Bundle
java-1.7.0-openjdk.x86_64 : OpenJDK Runtime Environment
java-1.7.0-openjdk-demo.x86_64 : OpenJDK Demos
java-1.7.0-openjdk-devel.x86_64 : OpenJDK Development Environment
java-1.7.0-openjdk-javadoc.noarch : OpenJDK API Documentation
java-1.7.0-openjdk-src.x86_64 : OpenJDK Source Bundle
java-1.8.0-openjdk.x86_64 : OpenJDK Runtime Environment
java-1.8.0-openjdk-debug.x86_64 : OpenJDK Runtime Environment with full debug on
java-1.8.0-openjdk-demo.x86_64 : OpenJDK Demos
java-1.8.0-openjdk-demo-debug.x86_64 : OpenJDK Demos with full debug on
java-1.8.0-openjdk-devel.x86_64 : OpenJDK Development Environment
java-1.8.0-openjdk-devel-debug.x86_64 : OpenJDK Development Environment with
java-1.8.0-openjdk-headless.x86_64 : OpenJDK Runtime Environment
java-1.8.0-openjdk-headless-debug.x86_64 : OpenJDK Runtime Environment with full
java-1.8.0-openjdk-javadoc.noarch : OpenJDK API Documentation
java-1.8.0-openjdk-javadoc-debug.noarch : OpenJDK API Documentation for packages
java-1.8.0-openjdk-src.x86_64 : OpenJDK Source Bundle
java-1.8.0-openjdk-src-debug.x86_64 : OpenJDK Source Bundle for packages with
ldapjdk.x86_64 : The Mozilla LDAP Java SDK
2.选择版本,进行安装
[root@centos6-01 java]# yum install java-1.8.0-openjdk
3.设置环境变量
[root@centos6-01 java]# vi /etc/profile
添加如下内容:
#set java environment
JAVA_HOME= /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.111-0.b15.el6_8.x86_64/
JRE_HOME= /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.111-0.b15.el6_8.x86_64//JRE
CLASS_PATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib
PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
export JAVA_HOME JRE_HOME CLASS_PATH PATH
生效修改
[root@centos6-01 java]#source /etc/profile
4.验证
[root@centos6-01 java]# 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)
方法三:用rpm安装JDK
1. 下载
已下载软件到/usr/java 目录下
2.使用rpm命令安装
rpm -ivh jdk-8u111-linux-x64.rpm
3.设置环境变量
[root@centos6-01 java]# vi /etc/profile
添加如下内容:
#set java environment
JAVA_HOME=/usr/java/jdk1.8.0_111
JRE_HOME=/usr/java/jdk1.8.0_111/JRE
CLASS_PATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib
PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
export JAVA_HOME JRE_HOME CLASS_PATH PATH
生效修改
[root@centos6-01 java]#source /etc/profile
4.验证
[root@centos6-01 java]# 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)
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/28282660/viewspace-2131288/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/28282660/viewspace-2131288/