1.下载jdk-7u51-linux-x64.tar.gz
拷贝解压到/opt
[[email protected] ~]# cp /home/temp/jdk-7u51-linux-x64.tar.gz /opt/
2.设置环境变量
export JAVA_HOME=/opt/jdk1.7.0_51 export JRE_HOME=$JAVA_HOME/jre export PATH=$PATH:$JAVA_HOME/bin export CLASSPATH=./:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar export JAVA_HOME PATH CLASSPATH
3 测试是否成功
[[email protected] ~]# java -version java 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)
时间: 2024-10-10 20:36:26