$ sudo mkdir /usr/lib/java $ sudo tar zxvf jdk-7u21-linux-i586.tar.gz -C /usr/lib/java $ cd /usr/lib/java $ ls
sudo gedit /etc/.profile
export JAVA_HOME=/usr/lib/java export JRE_HOME=${JAVA_HOME}/jre export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib export PATH=${JAVA_HOME}/bin:$PATH
原文:http://www.cnblogs.com/yuyutianxia/p/4003698.html