Ubuntu 14.04 安装 JDK 7.0

1、新建jvm文件夹-解压

# mkdir /usr/lib/jvm
# tar zxvf jdk-7u79-linux-x64.gz -C /usr/lib/jvm

2、设置环境变量,在/etc/profile文件的最后面增加:

# vi /etc/profile
export JAVA_HOME=/usr/lib/jvm/jdk1..0_79
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH

3、将系统默认的jdk修改过来

# update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1..0_79/bin/java
# update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1..0_79/bin/javac
# update-alternatives --install /usr/bin/jar jar /usr/lib/jvm/jdk1..0_79/bin/jar
# update-alternatives --config java
# update-alternatives --config javac
#update-alternatives --config jar

4、测试

# java -version
java version "1.7.0_79"
Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
Java HotSpot(TM) -Bit Server VM (build 24.79-b02, mixed mode)
上一篇:android 自定义 radiobutton 文字颜色随选中状态而改变


下一篇:【Netty学习】 ChannelInitializer 学习