JDK环境变量的配置:
方法一:$vi /etc/profile
输入o,在最后加入以下内容:
#set java environment
export JAVA_HOME=/usr/java/jdk1.8.0_05
export JRE_HOME=/usr/java/jdk1.8.0_05/jre
export PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
export CLASSPATH=:$CLASSPATH:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib:$JAVA_HOME/lib
export JACA_HOME
export PATH
export CLASSPATH
然后使环境变量立即生效
$source /etc/profile
测试是否成功
输入#java -versionjava version "1.8.0_05"Java(TM) SE Runtime Environment (build 1.8.0_05-b13)Java HotSpot(TM) 64-Bit Server VM (build 25.5-b02, mixed mode)
方法二:
[root@cc]# sudo nautilus
跳出来的窗口上选择文件=》打开父文件=》找到etc=》找到profile(可以在位置处搜profile)打开profile,在最下面加入
#set java environment
export JAVA_HOME=/usr/java/jdk1.8.0_05
export JRE_HOME=/usr/java/jdk1.8.0_05/jre
export PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
export CLASSPATH=:$CLASSPATH:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib:$JAVA_HOME/lib
export JACA_HOME
export PATH
export CLASSPATH
测试是否成功
输入#java -versionjava version "1.8.0_05"Java(TM) SE Runtime Environment (build 1.8.0_05-b13)Java HotSpot(TM) 64-Bit Server VM (build 25.5-b02, mixed mode)