标签:
wget http://120.52.72.24/download.oracle.com/c3pr90ntc0td/otn-pub/java/jdk/7u79-b15/jdk-7u79-linux-x64.tar.gz
cd /usr/lib
sudo mkdir jvm
进入JDK的下载目录(默认下载目录为用户根目录,可用 cd 切换到根目录),并解压jdk文件
cd
sudo tar zxvf jdk-7u79-linux-x64.tar.gz -C /usr/lib/jvm
3. 设置环境变量(全局)
如果未安装gedit,则先用apt-get安装gedit
sudo apt-get install gedit
设置全局变量
sudo vim /etc/profile
export JAVA_HOME=/usr/lib/jvm/jdk1.7.0_79
export CLASSPATH=".:$JAVA_HOME/lib:$CLASSPATH"
export PATH="$JAVA_HOME/bin:$PATH"
source /etc/profile
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.7.0_79/bin/java 300
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.7.0_79/bin/javac 300
sudo update-alternatives --config java
输入命令
java -version
见到JDK的信息则表示成功。
标签:
原文地址:http://www.cnblogs.com/qingbin-bai/p/95227639ba3740b5eb6fa5884cea891d.html