Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I installed jdk using the following command: sudo apt-get install default-jdk but it is the wrong version. I need Java SE 1.6 for building Android. When I try building Android, I get a message: Checking build tools versions...

You are attempting to build with the incorrect version of java.

Your version is: java version "1.6.0_24". The correct version is: Java SE 1.6.

Please follow the machine setup instructions at

How can I uninstall Java version "1.6.0_24" and install Java SE 1.6? I have alien installed so I can install .rpm packages.

share|improve this question

1.) If you’ve already installed OpenJDK (Or in ubantu generally it is already installed). Remove it by running this command: sudo apt-get purge openjdk*

2.) Then:

sudo add-apt-repository ppa:webupd8team/java

Then update:

sudo apt-get update

3.) Select which version you want To install Oracle Java 8:

sudo apt-get install oracle-java8-installer

To install Oracle Java 7:

sudo apt-get install oracle-java7-installer

To install the Java 6:

sudo apt-get install oracle-java6-installer
share|improve this answer

You can install the Java 6 JDK from Ubuntu's own repository by running the following line in the terminal:

sudo apt-get install openjdk-6-jdk

However, I'm running Eclipse, the Android SDK and I'm able to compile and run Android applications with OpenJDK 7 installed. It can be installed with:

sudo apt-get install openjdk-7-jdk
share|improve this answer
This is not "Sun's" or "Oracle's" Java 1.6. – NullNoname Mar 6 '14 at 11:34

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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