首页 > 代码库 > linux centos 卸载jdk
linux centos 卸载jdk
1.先看看OpenJDK的安装包
$ rpm -qa |grep java
tzdata-java-2013b-1.el6.noarch
java-1.6.0-openjdk-1.6.0.0-1.61.1.11.11.el6_4.x86_64
java-1.7.0-openjdk-1.7.0.19-2.3.9.1.el6_4.x86_64
2.检查OpenJDK版本号
$ java -version
java version "1.7.0_19"
OpenJDK Runtime Environment (rhel-2.3.9.1.el6_4-x86_64)
OpenJDK 64-Bit Server VM (build 23.7-b01, mixed mode)
3.卸载Openjdk
用root用户登录终端
$ su root
password:
$ rpm -e --nodeps java-1.7.0-openjdk-1.7.0.19-2.3.9.1.el6_4.x86_64
$ rpm -e --nodeps java-1.6.0-openjdk-1.6.0.0-1.61.1.11.11.el6_4.x86_64
$ rpm -e --nodeps tzdata-java-2013b-1.el6.noarch
4安装jdk-7u17-linux-x64.rpm
下载地址:http://pan.baidu.com/share/link?shareid=397488&uk=638583574
$ cd /jdk1.7所在文件夹
$ rpm -ivh jdk-7u17-linux-x64.rpm
Preparing... ########################################### [100%]
1:jdk ########################################### [100%]
Unpacking JAR files...
rt.jar...
Error: Could not open input file: /usr/java/jdk1.7.0_17/jre/lib/rt.pack
jsse.jar...
Error: Could not open input file: /usr/java/jdk1.7.0_17/jre/lib/jsse.pack
charsets.jar...
Error: Could not open input file: /usr/java/jdk1.7.0_17/jre/lib/charsets.pack
tools.jar...
Error: Could not open input file: /usr/java/jdk1.7.0_17/lib/tools.pack
localedata.jar...
Error: Could not open input file: /usr/java/jdk1.7.0_17/jre/lib/ext/localedata.pack
以上那些错误能够忽略,不影响jdk到安装和使用
5.配置环境变量
$vi /etc/profile
输入o,在最后增加下面内容:
JAVA_HOME=/usr/java/jdk1.7.0_17
JRE_HOME=/usr/java/jdk1.7.0_17/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
使环境变量马上生效
$source /etc/profile
6.測试安装是否成功
依次输入java,java -version,javac,看到输出信息就可以,比如
[root@chenpc-cent tools]# java -version
java version "1.7.0_17"
Java(TM) SE Runtime Environment (build 1.7.0_17-b02)
Java HotSpot(TM) 64-Bit Server VM (build 23.7-b01, mixed mode)
$ rpm -qa |grep java
tzdata-java-2013b-1.el6.noarch
java-1.6.0-openjdk-1.6.0.0-1.61.1.11.11.el6_4.x86_64
java-1.7.0-openjdk-1.7.0.19-2.3.9.1.el6_4.x86_64
2.检查OpenJDK版本号
$ java -version
java version "1.7.0_19"
OpenJDK Runtime Environment (rhel-2.3.9.1.el6_4-x86_64)
OpenJDK 64-Bit Server VM (build 23.7-b01, mixed mode)
3.卸载Openjdk
用root用户登录终端
$ su root
password:
$ rpm -e --nodeps java-1.7.0-openjdk-1.7.0.19-2.3.9.1.el6_4.x86_64
$ rpm -e --nodeps java-1.6.0-openjdk-1.6.0.0-1.61.1.11.11.el6_4.x86_64
$ rpm -e --nodeps tzdata-java-2013b-1.el6.noarch
4安装jdk-7u17-linux-x64.rpm
下载地址:http://pan.baidu.com/share/link?shareid=397488&uk=638583574
$ cd /jdk1.7所在文件夹
$ rpm -ivh jdk-7u17-linux-x64.rpm
Preparing... ########################################### [100%]
1:jdk ########################################### [100%]
Unpacking JAR files...
rt.jar...
Error: Could not open input file: /usr/java/jdk1.7.0_17/jre/lib/rt.pack
jsse.jar...
Error: Could not open input file: /usr/java/jdk1.7.0_17/jre/lib/jsse.pack
charsets.jar...
Error: Could not open input file: /usr/java/jdk1.7.0_17/jre/lib/charsets.pack
tools.jar...
Error: Could not open input file: /usr/java/jdk1.7.0_17/lib/tools.pack
localedata.jar...
Error: Could not open input file: /usr/java/jdk1.7.0_17/jre/lib/ext/localedata.pack
以上那些错误能够忽略,不影响jdk到安装和使用
5.配置环境变量
$vi /etc/profile
输入o,在最后增加下面内容:
JAVA_HOME=/usr/java/jdk1.7.0_17
JRE_HOME=/usr/java/jdk1.7.0_17/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
使环境变量马上生效
$source /etc/profile
6.測试安装是否成功
依次输入java,java -version,javac,看到输出信息就可以,比如
[root@chenpc-cent tools]# java -version
java version "1.7.0_17"
Java(TM) SE Runtime Environment (build 1.7.0_17-b02)
Java HotSpot(TM) 64-Bit Server VM (build 23.7-b01, mixed mode)
linux centos 卸载jdk
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。