1.下载jdk-7u51-linux-x64.tar.gz
拷贝解压到/opt
[root@macnd ~]# cp /home/temp/jdk-7u51-linux-x64.tar.gz /opt/
2.设置环境变量
export JAVA_HOME=/opt/jdk1.7.0_51export JRE_HOME=$JAVA_HOME/jreexport PATH=$PATH:$JAVA_HOME/binexport CLASSPATH=./:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jarexport JAVA_HOME PATH CLASSPATH
3 测试是否成功
[root@macnd ~]# java -versionjava version "1.7.0_51"Java(TM) SE Runtime Environment (build 1.7.0_51-b13)Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)