Ubuntu10版本安装JAVA5和JAVA6

JAVA5安装:
1.sudo vi /etc/apt/sources.list,将安装源更改为ubuntu 9.04的安装源为:
deb
http://archive.ubuntu.com/ubuntu/ jaunty main restricted universe multiverse
deb
http://archive.ubuntu.com/ubuntu/ jaunty-security main restricted universe multiverse
deb
http://archive.ubuntu.com/ubuntu/ jaunty-updates main restricted universe multiverse
deb
http://archive.ubuntu.com/ubuntu/ jaunty-proposed main restricted universe multiverse
deb
http://archive.ubuntu.com/ubuntu/ jaunty-backports main restricted universe multiverse
deb-src
http://archive.ubuntu.com/ubuntu/ jaunty main restricted universe multiverse
deb-src
http://archive.ubuntu.com/ubuntu/ jaunty-security main restricted universe multiverse
deb-src
http://archive.ubuntu.com/ubuntu/ jaunty-updates main restricted universe multiverse
deb-src
http://archive.ubuntu.com/ubuntu/ jaunty-proposed main restricted universe multiverse
deb-src
http://archive.ubuntu.com/ubuntu/ jaunty-backports main restricted universe multiverse
2.sudo apt-get update
3.sudo apt-get install sun-java5-jdk


JAVA6安装:
1.sudo apt-add-repository "deb
http://archive.canonical.com/ lucid partner" 
2.sudo apt-get update
3.sudo apt-get install sun-java6-jdk

 

 

环境变量的设置:
1.sudo vi /etc/profile,添加下列语句
# Set JAVA (这里是注释 不是SHELL命令)
# 使用java5
JAVA_HOME=path_to_java5
# 使用java6
#JAVA_HOME=path_to_java6
JRE_HOME=$JAVA_HOME/jre
PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH
CLASSPATH=.:$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib
export JAVA_HOME JRE_HOME PATH CLASSPATH
2. source /etc/profile

 

查看当前使用的java版本:
1. java -version
2. javac -version

 

 

 

 

 

 

 

你可能感兴趣的:(java,shell,ubuntu,Path,Deb)