查看当前java版本
[[email protected] ~]# java -version
java version "1.6.0_24"
OpenJDK Runtime Environment (IcedTea6 1.11.1) (rhel-1.45.1.11.1.el6-x86_64)
OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)
卸载JAVA
#rpm -qa|grep java
#rpm -e --nodeps java-1.7.0-openjdk
安装JDK7.0
#rpm -ivh jdk-7u67-linux-x64.rpm
jdk的安装目录为:/usr/java/jdk1.7.0_67
配置java环境
[[email protected] root]#vi /etc/profile
然后在文件的末尾加上以下三句话
export JAVA_HOME=/usr/java/jdk1.7.0_67
export CLASSPATH=.:$JAVA_HOME/lib:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin
使配置生效
#source /etc/profile
测试
#echo $JAVA_HOME
/usr/java/jdk1.7.0_67
原创文章,作者:奋斗,如若转载,请注明出处:https://blog.ytso.com/tech/aiops/1165.html