ubuntu安装Java jdk1.7.0

1.下载JDK  http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html

2.解压

3.在jdk1.7.0_45下面创建文件/etc/profile.d/development.sh,将下面的内容复制到该文件。

export JAVA_HOME=/usr/local/development/jdk1.7.0_45
export JRE_HOME=$JAVA_HOME/jre
export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH

4.在终端中执行命令(jdk文件路径需要修改/usr/local/lib/jdk1.7.0)

$sudo update-alternatives --install /usr/bin/java java /usr/local/lib/jdk1.7.0/bin/java 300  
$sudo update-alternatives --install /usr/bin/javac javac /usr/local/lib/jdk1.7.0/bin/javac 300  
$sudo update-alternatives --install /usr/bin/javap javap /usr/local/lib/jdk1.7.0/bin/javap 300  
$sudo update-alternatives --install /usr/bin/javadoc javadoc /usr/local/lib/jdk1.7.0/bin/javadoc 300  

5.可以运行 $java -version 测试,OK

 

posted on 2013-11-30 14:58  kingang  阅读(506)  评论(0编辑  收藏  举报

导航