Ubuntu – how to install openjdk

openjdkrepository

When I try

sudo apt-get install openjdk-7-jdk

I got a message telling me that the package could not be found in database. I guess I'm missing repositories.

here's the content of sources.list file :

deb http://fr.archive.ubuntu.com/ubuntu/ saucy restricted universe multiverse 
deb http://fr.archive.ubuntu.com/ubuntu/ saucy-updates restricted universe multiverse
deb http://fr.archive.ubuntu.com/ubuntu/ saucy-security restricted universe multiverse
deb http://archive.canonical.com/ubuntu saucy partner
deb http://extras.ubuntu.com/ubuntu saucy main
deb http://fr.archive.ubuntu.com/ubuntu/ saucy-proposed restricted universe multiverse
deb http://fr.archive.ubuntu.com/ubuntu/ saucy-backports restricted universe multiverse

Which is the repository to install openjdk 7. Thanks

When I do

sudo apt-get install -f 
apt-cache policy openjdk-7-jdk

I got this :

0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded  

openjdk-7-jdk:
  Installé : (aucun)
  Candidat : 7u51-2.4.4-0ubuntu0.13.10.1
  Table de version :
     7u51-2.4.4-0ubuntu0.13.10.1 0
         500 http://archive.ubuntu.com/ubuntu/ saucy-updates/main amd64 Packages
         500 http://archive.ubuntu.com/ubuntu/ saucy-security/main amd64 Packages
     7u25-2.3.12-4ubuntu3 0
        500 http://archive.ubuntu.com/ubuntu/ saucy/main amd64 Packages  

Best Answer

As JohnnyD said, add ppa:openjdk/ppa repository and then update it.After that, you can be able to install openjdk-7-jdk directly from that repository,

sudo add-apt-repository ppa:openjdk/ppa
sudo apt-get update
sudo apt-get install openjdk-7-jdk

Edit :

sudo apt-get install aptitude && sudo aptitude install openjdk-7-jdk

and not choose to keep the current version of the conflicting packages.

Related Question