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

Want to install fresh jdk 6 for Android development. Before I had jdk 7 installed which I removed for fresh jdk 6 installation. Tried using the webupd repository way, not of use, tried downloading the jdk from oracle and then unzipping it, not of use.

I want to know if removing these listed packages will help?

java -version
The program 'java' can be found in the following packages:
* default-jre
* gcj-4.6-jre-headless
* openjdk-6-jre-headless
* gcj-4.5-jre-headless
* openjdk-7-jre-headless
 Try: sudo apt-get install <selected package>

EDIT: in response to MrVaykadji :

I tried doing the commands ... after i executed the sudo apt-get install ----- I encountered this error message at the end of log:

update-alternatives: error: no alternatives for java. 
update-alternatives: using /usr/lib/jvm/java-6-oracle/jre/bin/ControlPanel to provide /usr/bin/ControlPanel (ControlPanel) in auto mode. 
update-alternatives: error: cannot stat file '/usr/lib/jvm/jdk-6u38-linux-x64-rpm.bin/java': Not a directory 
dpkg: error processing oracle-java6-installer (--configure):
 subprocess installed  post-installation script returned error 
exit status 2 
No apport report written because MaxReports is reached already 

Errors were encountered while processing: 
E: Sub-process /usr/bin/dpkg returned an error code (1) 
share|improve this question
There is a nice guide on how to it ----- – Tasos Mar 25 '14 at 17:34
Those packages contain java but are not installed on your system, you will need to install one of those packages to install java; but those are openjdk java(s), not oracle, so may or may not be what you exactly want. – i08in Mar 25 '14 at 17:37
can u please suggest me how to install those packages...Thanks – user261972 Mar 25 '14 at 18:26
You must have broke something while uninstalling java7, I don't see any other explaination. – MrVaykadji Mar 25 '14 at 20:06

This sould be enough :

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java6-installer

If you encounter problems, edit your main post and leave a comment here ;)

Regarding your java -version output, the packages aren't installed yet, that's why Ubuntu tells you to install one of them.

share|improve this answer

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.