Subscribe to our blog

Your email:

Current Articles | RSS Feed RSS Feed

Ubuntu 9.10, Java 5 and the Android Open Source Project

Submit to Digg digg it |  Add to delicious  delicious |  Submit to StumbleUpon StumbleUpon | Submit to Reddit reddit 

 

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

  $ sudo apt-get update

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

Tags: , ,

Comments

There is a mistake with method 1. 
 
The PATH should point  
 
 
~/tools/jdk1.5.0_21/bin
Posted @ Wednesday, January 06, 2010 2:12 AM by Zaki
Thank you!!!! Worked fine!
Posted @ Saturday, January 09, 2010 6:16 PM by kR105
link bold italics
Posted @ Saturday, January 16, 2010 5:40 PM by Chenchangfeng
Thanks Zaki 
 
 
 
/Enea Android Team
Posted @ Monday, January 25, 2010 7:42 AM by Enea Android Team
I've used the java5 packages from jaunty. I'd like to use java6 as default for other project. Is there a way to only use java5 for android
Posted @ Sunday, January 31, 2010 7:31 AM by Jaap
also you need to install eclipse-pde and eclipse: 
 
do this 
sudo apt-get install eclipse-pde eclipse-jdt 
 
Once this is done then install android plugin
Posted @ Sunday, January 31, 2010 7:45 AM by eamndo
Thank you Thank you Thank you. 
This was my savior while all other java 5 installation guides were Faileding.
Posted @ Sunday, April 18, 2010 1:45 PM by askPrins
Thank you. You saved my time!!
Posted @ Friday, May 21, 2010 11:00 AM by ladislav
Nice!!! Thanks!
Posted @ Friday, August 06, 2010 8:58 PM by Jerry
Post Comment
Name
 *
Email
 *
Website (optional)
Comment
 *

Allowed tags: <a> link, <b> bold, <i> italics