Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

error installing java on ubuntu 10 64bit

EDIT

I added this note to explain why I keep this question here. I added "Android" as keyword and I'd like to know whether someone else has tried to download the code and how it is possible to work around this problem. I fear that if I ask Ubuntu they would suggest me to use OpenJDK but the question is: did someone use that SDK to build Android code?

ORIGINAL

Sometime ago I downloaded the android source code on Ubuntu 10 64bit. I had problems but at the end I managed to get everything working. Now I'm trying to do it again on a fresh install of the same Ubuntu version but I'm having a problem.

Although I followed the instruction here I keep having the error:

Package sun-java6-jdk is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source E: Package sun-java6-jdk has no installation candidate

Googling gives you a lot of results that all give you the same solution:

sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"   
sudo apt-get update
sudo apt-get install sun-java6-jdk

I did it but it didn't work.

I'm running Ubuntu on a VM under VMWare.

I have also tried to add another source:

sudo add-apt-repository "deb-src http://archive.canonical.com/ubuntu lucid partner

but it didn't help

Maybe the answer is here:

Answer in SuperUser

but it is weird that on the Android portal there isn't any mention of it

like image 954
kingston Avatar asked Mar 16 '12 16:03

kingston


People also ask

Why does Java keep failing to install?

Active firewall or antivirus software may prevent Java from installing properly. Remember to turn your firewall or antivirus software back on when you have successfully completed the Java install.


2 Answers

The problem is that you should now download JDK manually. Somewhere I found these steps and it worked fine in my case:

  1. Download Java SE 6 JDK for Linux x86 self-extracting binary (if you work with 32bit platform)
  2. From the download folder, make the file executable chmod a+x jdk-6u<version>-linux-i586.bin
  3. Move the file to the jvm folder sudo mv jdk-6u<version>-linux-i586.bin /usr/lib/jvm/
  4. Change to the jvm folder and run the self-extracting binary cd /usr/lib/jvm
  5. sudo ./jdk-6u<version>-linux-i586.bin
  6. Everything will be extracted to a new jdk1.6 folder and you can delete the .bin file now.
  7. Make a symbolic link to the new java binary in the alternatives folder. sudo ln -s -b /usr/lib/jvm/jdk1.6<version>/jre/bin/java /etc/alternatives/java
  8. Append in your ~/.bashrc

    JAVA_HOME=/usr/lib/jvm/jdk1.6.<version>/
    

    PATH=$PATH:$JAVA_HOME/bin

  9. Double-check the version java -version

Remember that you can work only with JDK v6 version.

like image 71
Yury Avatar answered Oct 11 '22 15:10

Yury


Ensure the following:

  • make sure you have done sudo apt-get update to make sure you have the latest package information.

  • since it says

Package sun-java6-jdk is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source E: Package sun-java6-jdk has no installation candidate

you can search sudo apt-cache search sun-java6-jdk or simply apt-cache search java6 to see what it is referred from and then install that package if it has a different name.

  • Maybe try removing any and all PPAs you've added (I think you may have more than one with some typos etc.) and then add it again but using the GUI

Also, you could always use OpenJDK instead or add a 3rd party PPA

like image 32
TryTryAgain Avatar answered Oct 11 '22 13:10

TryTryAgain