603   Java Linux RedHat

1, mkdir -p /usr/local/java

2, tar -zxvf jdk-7u25-linux-x64.tar.gz -C /usr/local/java

3, /etc/profile

4, 添加环境变量

echo “export JAVA_HOME=/usr/local/java/jdk1.7.0_25” >> /etc/profile
echo “export CLASSPATH=.:\$JAVA_HOME/jre/lib:\$JAVA_HOME/lib/tools.jar” >> /etc/profile
echo “export JRE_HOME=\$JAVA_HOME/jre” >> /etc/profile
echo “export PATH=\$JAVA_HOME/bin:\$PATH” >> /etc/profile

5, save

6,source /etc/profile //使配置文件生效

7,java -version




Leave a Reply

Your email address will not be published. Required fields are marked *