在Ubuntu 10.04上安装java 1.5 java 1.6
在Ubuntu 10.04上安装java 1.5 java 1.6
2010-06-07 11:00:05| 分类: embedded linux|字号 订阅
Installing the JDK
The Sun JDK is no longer in Ubuntu's main package repository. In order to download it, you need to add the appropriate repository and indicate to the system which JDK should be used.
Java 6: for Gingerbread and newer
$ sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
$ sudo add-apt-repository "deb-src http://archive.canonical.com/ubuntu lucid partner"
$ sudo apt-get update
$ sudo apt-get install sun-java6-jdk
Java 5: for Froyo and older
$ sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu dapper main multiverse"
$ sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu dapper-updates main multiverse"
$ sudo apt-get update
$ sudo apt-get install sun-java5-jdk
在/etc/apt/source.list中加入
java 1.5
java 1.5
deb http://cz.archive.ubuntu.com/ubuntu dapper main multiverse |
java 1.6
- sudo apt-add-repository "deb http://archive.canonical.com/ lucid partner"
然后安装
sudo apt-get update
sudo apt-get update
$ sudo apt-get install sun-java5-jdk |
最后设置JAVA环境
ln -s /usr/lib/jvm/java-6-sun/bin/javac /etc/alternatives/javac
ln -s /usr/lib/jvm/java-6-sun/bin/java /etc/alternatives/java
ln -s /usr/lib/jvm/java-1.5.0-sun/bin/javac /etc/alternatives/javac
ln -s /usr/lib/jvm/java-1.5.0-sun/bin/java /etc/alternatives/java
sudo ln -s /usr/lib/jvm/java-1.5.0-sun/bin/javadoc /etc/alternatives/javadoc
ln -s /usr/lib/jvm/java-6-sun/bin/javac /etc/alternatives/javac
ln -s /usr/lib/jvm/java-6-sun/bin/java /etc/alternatives/java
ln -s /usr/lib/jvm/java-1.5.0-sun/bin/javac /etc/alternatives/javac
ln -s /usr/lib/jvm/java-1.5.0-sun/bin/java /etc/alternatives/java
sudo ln -s /usr/lib/jvm/java-1.5.0-sun/bin/javadoc /etc/alternatives/javadoc
$ sudo update-alternatives --config java
$ sudo update-alternatives --config javac
java -version
javac -version
$ sudo update-alternatives --config javac
java -version
javac -version