Ubuntu 9.10, Java 5 and the Android Open Source Project
Posted by Enea Android Team on Thu, Dec 03, 2009 @ 03:44 PM
Currently there is an issue with building the Android Open Source project on Ubuntu 9.10 Karmic Koala, or more specific with the Java 5 support. Java 5 was obsoleted by Sun on October 30 2009 and is not part of the Ubuntu 9.10 distribution. However there is still a need to use Java 5 for building Android since Java6 is not yet supported. There are two methods to get Java5 working on Ubuntu 9.10.
Method 1 - download and install from Sun
This method will let you install the Java5 JDK in a separate directory and add it to the path.
Download the Java5 JDK for Linux from http://java.sun.com/javase/downloads/5u21/jdk
This is a binary file that you should save to a suitable location like ~/tools
In order to make i executable chmod the file as
|
$ chmod 777 jdk-1_5_0_21-linux-i586.bin |
and run it
|
$ ./jdk-1_5_0_21-linux-i586.bin |
This will install the jdk to the current directory.
To use the JDK5 tools you need to add it first in the path before building the Android Open Source Project
|
$ export PATH=~/tools/jdk1.5.0_21/bin |
This allows you to remove the JDK5 from the path when not building Android and use the standard Java settings instead.
Method 2 - use the Ubuntu 9.04 repositories to get Java5
This method adds the Jaunty repositories and installs Java5 as the default java setting in the system. Open the sources file (/etc/apt/sources.list) for editing, as root
|
$ sudo gedit /etc/apt/sources.list |
and add:
|
deb http://us.archive.ubuntu.com/ubuntu/ jaunty multiverse deb http://us.archive.ubuntu.com/ubuntu/ jaunty-updates multiverse |
save the file and close gedit. Next sync your sources by running
and install
|
$ sudo apt-get install sun-java5-jdk |
To set the system to use Java 5 you need to update your java alternatives by running
|
$ sudo update-alternatives --config java |
Choose java-1.5.0-sun and you should be done.
Hopefully the Android Open Source Project will build with Java 6 shortly but the above solutions should get you going with platform work on Ubuntu 9.10.
Enea Whitepaper

The emergence of Android paves the way for new opportunities for the world's mobile phone manufacturers. Learn More.