代码改变世界

在ubuntu10.04安装java5和java6

2010-11-08 12:40  cppguy  阅读(557)  评论(0编辑  收藏  举报

Java5:

早在ubuntu 9.10中,ubuntu就已经去除了对sun-java5-jdk的支持,但是为了进行android的开发,又必须安装sun-java5-jdk。那么在享受ubuntu 10.04好处的同时,如何来进行sun-java5-jdk的安装那。经过多次的摸索,下面是一个方案:
  1.编辑/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.安装java5,apt-get install sun-java5-jdk.
  4.更改默认jdk的方法如下:
update-alternatives --config java
显示如下,然后键入
java-1.5.0-sun的编号:
有 2 个选项可用于替换项 java (提供 /usr/bin/java)。

 

Java6:

 

ubuntu 10.04

Sun Java moved to the Partner repository

For Ubuntu 10.04 LTS, the sun-java6 packages have been dropped from the Multiverse section of the Ubuntu archive. It is recommended that you use openjdk-6 instead.

If you can not switch from the proprietary Sun JDK/JRE to OpenJDK, you can install sun-java6 packages from the Canonical Partner Repository. You can configure your system to use this repository via command-line:

add-apt-repository "deb http://archive.canonical.com/ lucid partner"

---------------
于是:
$ sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
$ sudo apt-get update
$ sudo apt-get install sun-java6-jdk