Installing Sun Java, Eclipse, and Android SDK on Ubuntu 10.04
Ever since Ubuntu (and Debian) removed Sun Java from their repos, the official instructions have been out of date. (Additionally, Debian’s and Ubuntu’s wikis about installing Sun Java have become out of date.) Google knows about this since I’ve seen the issue brought up on their mailing lists, but they’ve never updated the documentation. It is yet another reason why I feel Google does not care so much about third party developers, but c’est la vie.
Additionally, the Google release cycle moves much faster than Debian’s. Ubuntu also has trouble keeping large packages like Eclipse up to date, so it’s not always certain that the version of Eclipse available in your package manager will be the version by the ADT Plugin. For example, the version of Eclipse in Natty (11.04) was 3.5, which was originally released in 2009. Google still advises developers to use Ubuntu Lucid 10.04 even with all these outdated packages. (Anyways, Linux package management doesn’t fit with today’s model of desktop computing.)
These instructions won’t require root.
- Download the Java .run file (JDK 6 or 7 both work), Eclipse (just the IDE for Java developers is fine), and the Android SDK.
- I created a directory in ~/opt to contain all of these. Unpack all three files into it.
- I created a directory in ~/bin and symlinked the Eclipse executable into it (ln -s ../opt/eclipse/eclipse)
- Edit both ~/.bashrc and ~/.profile and ensure JAVA_HOME is set to your local JDK (eg, something like JAVA_HOME=$HOME/opt/jdk1.6.0_31)
- Edit both ~/.bashrc and ~/.profile and ensure ~/bin, the Java executables, and the Android SDK tools are prepended to your $PATH (eg, something should be like PATH=$HOME/bin:$JAVA_HOME/bin:$HOME/opt/android-sdk-linux/tools:$HOME/opt/android-sdk-linux/platform-tools:$PATH). (Reportedly, you can set ~/.pam_environment that will do all your environment variables instead of editing and maintaining two files, but I haven’t tried that.)
- Logout and log back in.
You should now be able to run Eclipse. It should find your locally installed JDK in ~/opt. Once you get into Eclipse, follow the instructions for installing the ADT, which will then download the latest SDK and tools for you.