删除CentOS系统自带的jdk

在安装CentOS6.4时,系统会自动安装jdk,先把它下载掉,装上自定义的jdk。
卸载步骤如下:

[root@localhost ~]# rpm -qa|grep jdk
java-1.6.0-openjdk-1.6.0.0-1.50.1.11.5.el6_3.x86_64
java-1.7.0-openjdk-1.7.0.9-2.3.4.1.el6_3.x86_64

[root@localhost ~]# rpm -qa|grep gcj
java-1.4.2-gcj-compat-1.4.2.0-40jpp.115  
libgcj-4.1.2-48.el5  

[root@localhost ~]# yum -y remove java java-1.6.0-openjdk-1.6.0.0-1.50.1.11.5.el6_3.x86_64
[root@localhost ~]# yum -y remove java java-1.7.0-openjdk-1.7.0.9-2.3.4.1.el6_3.x86_64
[root@localhost ~]# yum -y remove java java-1.4.2-gcj-compat-1.4.2.0-40jpp.115  
[root@localhost ~]# yum -y remove libgcj-4.1.2-48.el5  

 

先查看有哪些可安装的
yum list java*

选择要安装的包 
yum install -y java-1.8.0-openjdk-devel.x86_64

等待安装完成执行java -version

vim /etc/profile
MAVEN_HOME=/usr/local/maven3
export MAVEN_HOME
export PATH=${PATH}:${MAVEN_HOME}/bin

export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/jre/lib/rt.jar
export PATH=$PATH:$JAVA_HOME/bin

 

posted on 2013-03-23 17:14  Ruthless  阅读(9600)  评论(0编辑  收藏  举报