This question already has an answer here:

I have Ubuntu 12.10 x64 installed on a virtual device (VMware workstation) on a host system Windows 8. I downloaded android source code. I wanted to build it, and it says:

    Checking build tools versions...
You are attempting to build with an unsupported JDK.

You use OpenJDK but only Sun/Oracle JDK is supported.


I tried:

sudo apt-get -y remove --purge openjdk-7-jdk openjdk-7-jre

and I still have OpenJKD 7 installed. How can I uninstall OpenJDK and install a JDK which could build android?

marked as duplicate by Mitch, belacqua, Rinzwind, Seth, Eric Carvalho Apr 15 '13 at 0:06

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

up vote 5 down vote accepted

In Ubuntu you don't have to uninstall one JDK to use another. You can have multiple Java versions installed and switch between them as you like. What matters is witch one is set as default.

You can install Oracle Java JDK follow this guide (easy option) or get it right from the Oracle here (well..less easy option).

Chose another Java loader:

sudo update-alternatives --config java

Chose another compiler (this is what you need):

sudo update-alternatives --config javac

Chose Java Web Start:

sudo update-alternatives --config javaws 

You might also be interested in installing Android SDK on your Ubuntu VM. Here is a great guide for that.

Not the answer you're looking for? Browse other questions tagged or ask your own question.