> CentOS > CentOS故障 >

CentOS7系统安装jdk异常报错解决方法

centos安装jdk-7u15-linux-x64.rpm异常解决方法
首先先将jdk-7u15-linux-x64.rpm放到usr/locl/src目录下
[root@localhost ~]# rpm -ivh jdk-7u15-linux-x64.rpm 
Preparing...                ########################################### [100%]
   1:jdk                    ########################################### [100%]
Unpacking JAR files...
        rt.jar...
Error: Could not open input file: /usr/java/jdk1.7.0_15/jre/lib/rt.pack
        jsse.jar...
Error: Could not open input file: /usr/java/jdk1.7.0_15/jre/lib/jsse.pack
        charsets.jar...
Error: Could not open input file: /usr/java/jdk1.7.0_15/jre/lib/charsets.pack
        tools.jar...
Error: Could not open input file: /usr/java/jdk1.7.0_15/lib/tools.pack
        localedata.jar...
Error: Could not open input file: /usr/java/jdk1.7.0_15/jre/lib/ext/localedata.pack
 
报出这个异常的解决方法是配置java的环境变量
[root@localhost ~]# vi /etc/profile
 末尾加上
set JAVA_HOME=/usr/java/jdk1.7.0_15
export JAVA_HOME
set PATH=$PATH:$JAVA_HOME
export PATH
set CLASSPATH=.:JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export CLASSPATH
 保存
[root@localhost ~]# java -version
java version "1.7.0_15"
Java(TM) SE Runtime Environment (build 1.7.0_15-b03)
Java HotSpot(TM) 64-Bit Server VM (build 23.7-b01, mixed mode)


(责任编辑:IT)