Ubuntu12.04安装JDK
1、先到官网下载JDK
http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1637583.html
2、将其解压到/usr/lib/jvm
sudotar zxvf ./jdk-7u5-linux-x64.tar.gz -C /usr/lib/jvm
3、修改环境变量,编辑.bashrc
vim ~/.bahsrc
exportJAVA_HOME=/usr/lib/jvm/jdk1.7.0_05
exportJRE_HOME=${JAVA_HOME}/jre
exportCLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
exportPATH=${JAVA_HOME}/bin:$PATH
4、保存退出,输入
source ~/.bashrc
即可生效