FORUMS
Remove All Ads from XDA

[Tutorial] Install Sun Java JDK 6 on Ubuntu 12.04 LTS

1,280 posts
Thanks Meter: 2,049
 
By Peteragent5, Senior Member on 30th November 2012, 04:43 AM
Post Reply Email Thread


Installing Java JDK 6

Code:
sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu hardy main multiverse"
sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu hardy-updates main multiverse"
sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
sudo apt-get update
sudo apt-get install sun-java6-jdk
Quote:
Originally Posted by trevd

For good measure we can also install the oracle-java7-jdk using the apt-repository provide by www.webupd8.org

Code:
sudo add-apt-repository "deb http://ppa.launchpad.net/webupd8team/java/ubuntu precise main"
sudo apt-get update 
sudo apt-get install sun-java5-jdk sun-java6-jdk oracle-java7-installer

Test Java: java -version

Credits to:
Google
Android Source
trevd
The Following 20 Users Say Thank You to Peteragent5 For This Useful Post: [ View ] Gift Peteragent5 Ad-Free
 
 
18th December 2012, 05:29 AM |#2  
htchoi5609's Avatar
Senior Member
Flag seoul
Thanks Meter: 510
 
Donate to Me
More
Thx but it dosent work T^T
18th December 2012, 09:36 AM |#3  
Quote:
Originally Posted by htchoi5609

Thx but it dosent work T^T

I Think this was covered back in may with this [GUIDE] Simple Java6 installation on Precise/Mint-Maya/Ubuntu 12.04 LTS

Nothing against the OP, Credits for attempting the spread the knowledge but that ubuntu help page is just plain doing it wrong when it comes to oracle! Unfortunately the entire internet ( yes, I searched it all ) seems to use it as a reference so there's well over 9000 guides that seem to use that script retrieval method. It's simply not required

Just use the google way and pull both jdk-5 and jdk-6 from ubuntu's own archived apt-repos, it's never let me down yet! For good measure we can also install the oracle-java7-jdk using the apt-repository provide by www.webupd8.org

Code:
sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu hardy main multiverse"
sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu hardy-updates main multiverse"
sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
sudo add-apt-repository "deb http://ppa.launchpad.net/webupd8team/java/ubuntu precise main"
sudo apt-get update 
sudo apt-get install sun-java5-jdk sun-java6-jdk oracle-java7-installer
all the java under the sun ( microsystems ) and 1 under oracle
The Following 11 Users Say Thank You to trevd For This Useful Post: [ View ] Gift trevd Ad-Free
11th March 2013, 03:06 PM |#4  
jonah1234's Avatar
Senior Member
Thanks Meter: 1,091
 
More
I'm getting this error when trying to update...
Code:
anonymous@ubuntu:~$ sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
anonymous@ubuntu:~$ sudo apt-get update
E: Could not get lock /var/lib/apt/lists/lock - open (11: Resource temporarily unavailable)
E: Unable to lock directory /var/lib/apt/lists/
anonymous@ubuntu:~$
can anyone help please. thanks in advance.
11th March 2013, 03:34 PM |#5  
Re: [Tutorial] Install Sun Java JDK 6 on Ubuntu 12.04 LTS
Looks like you've got another program thats locking the access to the sources. this normally you normally get this error if you forget to add sudo. Are you running automatic background updates or have you got a package manager open or the sources dialog?
Might be worth giving it the old "switch it on and off" again routine then try again

Sent from my Nexus 7 using xda premium
The Following User Says Thank You to trevd For This Useful Post: [ View ] Gift trevd Ad-Free
11th March 2013, 03:34 PM |#6  
Peteragent5's Avatar
OP Senior Member
Flag Richmond
Thanks Meter: 2,049
 
Donate to Me
More
Quote:
Originally Posted by jonah1234

I'm getting this error when trying to update...

Code:
anonymous@ubuntu:~$ sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
anonymous@ubuntu:~$ sudo apt-get update
E: Could not get lock /var/lib/apt/lists/lock - open (11: Resource temporarily unavailable)
E: Unable to lock directory /var/lib/apt/lists/
anonymous@ubuntu:~$
can anyone help please. thanks in advance.

Try these commands:
Code:
sudo rm /var/lib/apt/lists/* -vf 
sudo apt-get update
13th March 2013, 05:53 PM |#7  
jonah1234's Avatar
Senior Member
Thanks Meter: 1,091
 
More
Ok now the sudo apt-get update worked but i'm getting another error...
Code:
anonymous@ubuntu:~$ sudo apt-get install sun-java6-jdkReading package lists... Done
Building dependency tree       
Reading state information... Done
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
anonymous@ubuntu:~$
14th March 2013, 01:31 AM |#8  
Peteragent5's Avatar
OP Senior Member
Flag Richmond
Thanks Meter: 2,049
 
Donate to Me
More
Quote:
Originally Posted by jonah1234

Ok now the sudo apt-get update worked but i'm getting another error...

Code:
anonymous@ubuntu:~$ sudo apt-get install sun-java6-jdkReading package lists... Done
Building dependency tree       
Reading state information... Done
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
anonymous@ubuntu:~$

Have you added the repos?
14th March 2013, 12:12 PM |#9  
jonah1234's Avatar
Senior Member
Thanks Meter: 1,091
 
More
Re: [Tutorial] Install Sun Java JDK 6 on Ubuntu 12.04 LTS
Quote:
Originally Posted by Peteragent5

Have you added the repos?

Yessir. It works up until it's time to install.

Sent from my Sense 5 Droid DNA
24th March 2013, 02:52 AM |#10  
flowish's Avatar
Retired Recognized Developer
Thanks Meter: 799
 
Donate to Me
More
i think this code doesnt work and we dont need, because this is for ubuntu hardy and lucid, not for precise pangolin.
sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu hardy main multiverse"
sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu hardy-updates main multiverse"
sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"


another tutorial,open terminal and type :

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



The Following 4 Users Say Thank You to flowish For This Useful Post: [ View ] Gift flowish Ad-Free
24th March 2013, 11:49 AM |#11  
Quote:
Originally Posted by flowish

i think this code doesnt work and we dont need, because this is for ubuntu hardy and lucid, not for precise pangolin.
sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu hardy main multiverse"
sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu hardy-updates main multiverse"
sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"

Nah, Apt doesn't work like that, and using these archive repositories works on any version and any ubuntu based distro, well anywhere you've got apt installed really. although some distro don't come with add-apt-repository which is a python helper script, in which case you can manually add following the lines to /etc/apt/sources.list.

Code:
deb http://old-releases.ubuntu.com/ubuntu hardy main multiverse
deb-src http://old-releases.ubuntu.com/ubuntu hardy main multiverse
deb http://old-releases.ubuntu.com/ubuntu hardy-updates main multiverse
deb-src http://old-releases.ubuntu.com/ubuntu hardy-updates main multiverse
deb http://archive.canonical.com/ lucid partner
deb-src http://archive.canonical.com/ lucid partner
The "version" labels are irrelevant to the installation and are used to help apt resolve the directory on the web server where the Packages list is located, hardy's multiverse one is here http://archive.ubuntu.com/ubuntu/ubu.../binary-amd64/ for example. this is what "apt-get update" is doing

The reason for all three repository being needed is, java6 in the lucid repository has a dependency on a package found in the hardy repos, the upshot of adding all three is the option of installing java5 as well, just in case you get an urge to build any version of android that is pre gingerbread

All that being said using webupd8team ppa repository is fine. anything beats messing around with some daft installation script and an overly complicated multi-step process which seems to have been a previously banded about as the installation method.

Here's a console dump for both Ubuntu 12.04 and lubuntu 12.10. This is what you should be seeing if everything is working correctly.

Thanks
The Following 3 Users Say Thank You to trevd For This Useful Post: [ View ] Gift trevd Ad-Free
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes