编辑:$ sudo gedit /etc/profile
文件结尾加:
export JAVA_HOME=/usr/lib/jvm/jdk1.7.0_75
export JRE_HOME=/usr/lib/jvm/jdk1.7.0_75/jre
export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$JAVA_HOME:$PATH
结束:
$ javac
...
$ java -version