install sun java in ubuntu

1. 下载:

http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html

2. 解压安装:

sudo tar zxvf ./jdk-7u45-linux-x64.tar.gz  -C /usr/lib/jvm
cd /usr/lib/jvm
sudo mv jdk1..0_45/ java--sun

3. 环境变量:

export JAVA_HOME=/usr/lib/jvm/java--sun
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH

4. 配置默认:

sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/java--sun/bin/java
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/java--sun/bin/javac
sudo update-alternatives --install /usr/bin/jar jar /usr/lib/jvm/java--sun/bin/jar
sudo update-alternatives --install /usr/bin/javah javah /usr/lib/jvm/java--sun/bin/javah
sudo update-alternatives --install /usr/bin/javap javap /usr/lib/jvm/java--sun/bin/javap
sudo update-alternatives --config java  

参考:http://blog.csdn.net/snowdream86/article/details/6677450

上一篇:全国计算机等级考试二级教程2019年版——Python语言程序设计参考答案


下一篇:【Linux】Ubuntu13.10搭建gitlab报错信息及解决