Unable to Install Java 6 JRE on Ubuntu 11.04

Asked by bc on 2011-09-21

I'm a new Ubuntu user wanting to install Java; tried commands below:

Method 1
sudo apt-get install sun-java6-jre sun-java6-plugin sun-java6-fonts

Method 2
sudo add-apt-repository ppa:ferramroberto/java
sudo apt-get update
sudo apt-get install sun-java6-jre sun-java6-plugin sun-java6-fonts

source: http://www.ubuntugeek.com/install-jre-in-ubuntu-11-04-natty-using-ppa.html

Installation was unsuccessful; received error messages:

The following packages have unmet dependencies:
 sun-java6-jre : Depends: sun-java6-bin (>= 6.26-1natty1) but it is not going to be installed or
                          ia32-sun-java6-bin (>= 6.26-1natty1) but it is not installable
                 Recommends: gsfonts-x11 but it is not going to be installed
 sun-java6-plugin : Depends: sun-java6-bin (>= 6.26-1natty1) but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
computer@computer-1:~$ apt-get -f install
E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu sun-java6 Edit question
Assignee:
No assignee Edit question
Solved by:
marcobra (Marco Braida)
Solved:
2011-09-22
Last query:
2011-09-22
Last reply:
2011-09-21

you must use sudo to on apt-get commands so type:

sudo apt-get -f install

give yuor password when requested you will not see any screen chars when you type the password so type then press enter

bc (bc-m) said : #2

Thanks marcobra (Marco Braida), that solved my question.

Gabriella (biscottasl) said : #3

I did it but i received the following

 Errore
E: Encountered a section with no Package: header
E: Problem with MergeList /var/lib/apt/lists/it.archive.ubuntu.com_ubuntu_dists_natty_main_binary-i386_Packages
E: L'elenco dei pacchetti o il file di stato non può essere letto o aperto.