1.检查当前服务器中是否有安装jdk
rpm -qa|grep java
2. 批量删除java
rpm -qa | grep java | xargs rpm -e --nodeps
3. 安装jdk
rpm -ivh oracle-j2sdk1.7-1.7.0+update67-1.x86_64.rpm
4.配置环境变量
export JAVA_HOME=/usr/java/jdk1.7.0_67-cloudera
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH==.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
5.生效
source /etc/profile