linux下卸载默认安装java以及安装JDK1.6

卸载默认安装的JDK

rpm -qa | grep java

查询默认安装的JDK

java -e --nodeps java-强制卸载默认java

安装JDK1.6时需要授权

[root@rac2 bea]# chmod u+x jre_6u22_linux_i586_rpm.bin

[root@rac2 bea]# ./jre_6u22_linux_i586_rpm.bin

[root@rac2 bea]# java -version

java version "1.6.0_22" Java(TM) SE Runtime Environment (build 1.6.0_22-b04)

Java HotSpot(TM) Client VM

(build 17.1-b03, mixed mode, sharing)

有些系统会自动设置环境,如果以上命令没显示结果,则需配置下环境变量:

echo "export JAVA_HOME=/usr/java/default" >> /etc/profile

echo "export JRE_HOME=/usr/java/jre1.6.0_22">>/etc/profile

echo "export CLASSPATH=$JAVA_HOME/lib:$JRE_HOME/lib">>/etc/profile

echo "export PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin">>/etc/profile

如下: [root@rac2 default]# echo "export JAVA_HOME=/usr/java/default" >> /etc/profile

[root@rac2 default]# echo "export JRE_HOME=/usr/java/jre1.6.0_22">>/etc/profile

[root@rac2 default]# echo "export CLASSPATH=$JAVA_HOME/lib:$JRE_HOME/lib">>/etc/profile

[root@rac2 default]# echo "export PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin">>/etc/profile

[root@rac2 default]# source /etc/profile

[root@rac2 default]# echo $JAVA_HOME

/usr/java/default

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