Linux安装JDK7

wget http://download.oracle.com/otn-pub/java/jdk/7u75-b13/jdk-7u75-linux-x64.tar.gz?AuthParam=1428683377_f0fd3c334843ff13ba85345419ab7625 # 替换成官网实际链接
tar xzf jdk-7u75-linux-x64.tar.gz 
sudo mv jdk1.7.0_75/ /opt/
cd /opt/jdk1.7.0_75
sudo chown -R root.root .
sudo alternatives --install /usr/bin/java java /opt/jdk1.7.0_75/bin/java 2
sudo alternatives --config java
sudo alternatives --install /usr/bin/jar jar /opt/jdk1.7.0_75/bin/jar 2
sudo alternatives --install /usr/bin/javac javac /opt/jdk1.7.0_75/bin/javac 2
sudo alternatives --set jar /opt/jdk1.7.0_75/bin/jar
sudo alternatives --set javac /opt/jdk1.7.0_75/bin/javac 
vi ~/.bash_profile

export JAVA_HOME=/opt/jdk1.7.0_75
export JRE_HOME=/opt/jdk1.7.0_75/jre
export PATH=$PATH:/opt/jdk1.7.0_75/bin:/opt/jdk1.7.0_75/jre/bin