卸载系统自带的JDK的脚本并安装1.6.0.32版本的jdk
#!/bin/bash homefile=/usr/local/java cd $homefile homelist=`sudo rpm -aq|grep java` for file in $homelist do sudo rpm -e $file done cd $homefile ./jdk-6u32-linux-x64.bin -D $homefile #需要手动点击一下 echo "export JAVA_HOME=/usr/local/java/jdk1.6.0_32" >> /etc/profile echo "export PATH="$JAVA_HOME/bin:$PATH"" >> /etc/profile source /etc/profile java -version exit 0脚本完成后需要用source执行该命令。