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) 
  • 1
    There is a nice guide on how to it ----- askubuntu.com/questions/67909/how-do-i-install-oracle-jdk-6
    – Tasos
    Mar 25, 2014 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.
    – jobin
    Mar 25, 2014 at 17:37
  • can u please suggest me how to install those packages...Thanks
    – user261972
    Mar 25, 2014 at 18:26
  • You must have broke something while uninstalling java7, I don't see any other explaination.
    – MrVaykadji
    Mar 25, 2014 at 20:06

1 Answer 1


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.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .