vi /etc/profile
向文件里面追加以下内容:
export JAVA_HOME=/usr/local/java/jdk1.7.0_79 export PATH=$JAVA_HOME/bin:$PATH export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
使修改生效
引用
[root@admin local]# source /etc/profile //使修改立即生效
[root@admin local]# echo $PATH //查看PATH值
[root@admin local]# echo $PATH //查看PATH值
参考: http://blog.csdn.net/yulei2008_/article/details/51568493
linux jdk7下载:
http://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-javase7-521261.html#jdk-7u80-oth-JPR