[Ubuntu Maverick] JDK5 Installation/Setup for building Android in x64 architecture

Friday, January 7, 2011
Sun-JDK5 is one of those prerequisites that used to build android source successfully.
(According to official setup notes: Java 6 is not supported, because of incompatibilities with @Override.) The default JDK choose by Maverick was icedtea6, which is not recommended for building android, so, we're gonna install JDK5 instead of icedtea.

Unfortunately, JDK5 was abandoned by Ubuntu 10.10/10.04, but fortunately, Janty(9.04) still have JDK5 in its repository. So, let's move on.

Add packages sources to /etc/apt/sources.list:
deb http://archive.ubuntu.com/ubuntu dapper main multiverse
deb http://archive.ubuntu.com/ubuntu dapper-updates main multiverse

and then:
$sudo apt-get update
$sudo apt-get install sun-java5-jdk

after installation finished, use
$java -version
to check the current java version.

If you had JDK6 installed before JDK5, you probably need help from 'update-alternatives'.
First, list all Java installed,
$update-java-alternatives -l
Second, set the JDK5 as system default,
$sudo update-java-alternatives -s java-1.5.0-sun
You are ALL SET!

2 意見:

purple said...

hai i just try but it still failed. the output like this:

E: Some index files failed to download, they have been ignored, or old ones used instead.
msc05-12@msc05-12-desktop:~$ sudo apt-get install sun-java5-jdk
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Couldn't find package sun-java5-jdk
msc05-12@msc05-12-desktop:~$

purple said...

hai had tried it. but the output is like tis:

E: Some index files failed to download, they have been ignored, or old ones used instead.
msc05-12@msc05-12-desktop:~$ sudo apt-get install sun-java5-jdk
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Couldn't find package sun-java5-jdk
msc05-12@msc05-12-desktop:~$