jdk安装
下载地址:
http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
1.下载jdk-7u79-linux-x64
2.
sudo mkdir /usr/lib/jvm
sudo tar zxvf jdk-7u79-linux-x64.tar.gz -C /usr/lib/jvm //移动文件
cd /usr/lib/jvm
sudo mv jdk1.7.0_79 java
4.添加环境变量
sudo vi ~/.bashrc
加入如下内容
export JAVA_HOME=/usr/lib/jvm/java
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
5.测试
java -version
安装成功后出现下面:
java version "1.7.0_21"
Java(TM) SE Runtime Environment (build 1.7.0_21-b11)
Java HotSpot(TM) Server VM (build 23.21-b01, mixed mode)
------------------------------
另一种方法:
只需要三个命令搞定:
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer
下载地址:
http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
1.下载jdk-7u79-linux-x64
2.
sudo mkdir /usr/lib/jvm
sudo tar zxvf jdk-7u79-linux-x64.tar.gz -C /usr/lib/jvm //移动文件
cd /usr/lib/jvm
sudo mv jdk1.7.0_79 java
4.添加环境变量
sudo vi ~/.bashrc
加入如下内容
export JAVA_HOME=/usr/lib/jvm/java
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
5.测试
java -version
安装成功后出现下面:
java version "1.7.0_21"
Java(TM) SE Runtime Environment (build 1.7.0_21-b11)
Java HotSpot(TM) Server VM (build 23.21-b01, mixed mode)
------------------------------
另一种方法:
只需要三个命令搞定:
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer