linux下安装jdk

安装说明

系统环境:centos-6.5
安装方式:rpm安装
软件:jdk-7-linux-x64.rpm
下载地址:http://www.oracle.com/technetwork/java/javase/downloads/java-se-jdk-7-download-432154.html

安装

上传jdk

linux下安装jdk_第1张图片

安装

[root@localhost ~]# rpm -ivh jdk-7u71-linux-x64.rpm 

报错:

[root@localhost ~]# rpm -ivh jdk-7u71-linux-x64.rpm 
Preparing...                ########################################### [100%]
   1:jdk                    ########################################### [100%]
Unpacking JAR files...
    rt.jar...
    jsse.jar...
    charsets.jar...
    tools.jar...
    localedata.jar...
    jfxrt.jar...

unpacking不用管,并不是报错,jar已经安装成功

配置环境变量

进入下面路径

[root@localhost ~]# cd /usr/local/

添加下面的配置

[root@localhost ~]# vi + /etc/profile
向文件里面追加以下内容:
JAVA_HOME=/usr/java/jdk1.7.0 JRE_HOME=/usr/java/jdk1.7.0/jre
PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib
export JAVA_HOME JRE_HOME PATH CLASSPATH
[root@localhost local]# source /etc/profile

查看配置

[root@localhost local]# source /etc/profile
[root@localhost local]# echo $PATH
/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/usr/java/jdk1.7.0/bin:/usr/java/jdk1.7.0/jre/bin

查看环境变量

[root@localhost ~]# echo $PATH
/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/usr/java/jdk1.7.0/bin:/usr/java/jdk1.7.0/jre/bin

你可能感兴趣的:(jdk,linux)