3

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  
  • there's openjdk7 in main server packages.ubuntu.com/source/saucy/openjdk-7 did you try to install from main server? edit /etc/apt/sources.list – JoKeR Mar 2 '14 at 15:23
  • Now I have the error unmet dependencies. I will look to fix that – Hunsu Mar 2 '14 at 15:26
  • you'll be having unmet dependencies with the packages that have not yet been updated in fr.archive.ubuntu.com you rather should wait til' it appears in your current server repos or install it manually and so on... Alternative way out disable fr.archive temporary. how to resolve unmet dependencies – JoKeR Mar 2 '14 at 15:34
  • I have tried all the solution given in your link but it doesn't work for me. If I disable fr.archive I got not found error. How can I install the current version in the repository? – Hunsu Mar 2 '14 at 16:08
  • You can't add anything to fr.archive if that what you mean as it's maintained by the owners who responsible for it. when you disable fr.archive you must enable us.archive for example and run sudo apt-get update – JoKeR Mar 2 '14 at 16:14
6

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.

| improve this answer | |
  • I have tried that and got unmet dependencies error. openjdk-7-jdk : Dpends: openjdk-7-jre (= 7u51-2.4.4-0ubuntu0.13.10.1) but will not be installed – Hunsu Mar 2 '14 at 16:32
  • try sudo apt-get install -f.If the unmet dependencies are not cleared then post the output of sudo apt-get install -f in your question. – Avinash Raj Mar 2 '14 at 16:33
  • please try to choose different server(Best server) in software and updates.After choosing best server, update it by running sudo apt-get update then install openjdk. – Avinash Raj Mar 2 '14 at 16:40
  • I changed it to the main server but it doesn't work. – Hunsu Mar 2 '14 at 16:48
  • post the output of apt-cache policy openjdk-7-jdk – Avinash Raj Mar 2 '14 at 16:49
0

OpenJdk's run-time environments and development is available under Ubuntu's Universe/Java section. Following are the steps to install:

  1. If Universe repository in not allowed, allow it and update:

    sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) universe"
    sudo apt-get update
    
  2. Install Java Runtime Environment with:

    sudo apt-get install --install-suggests openjdk-7-jre
    
  3. Install Java Development Kit if you want to develop Java programs:

    sudo apt-get install --install-suggests openjdk-7-jdk
    

Useful terminal shortcut: Ctrl+Shift+V can be used to paste copied text to terminal.

| improve this answer | |
  • It is enabled but it doesn't work. fr.tinypic.com/view.php?pic=hsv0a0&s=8#.UxNlRttWUQU – Hunsu Mar 2 '14 at 17:07
  • did you try sudo apt-get install openjdk-7-jre – precise Mar 2 '14 at 17:10
  • Yes and I have this error openjdk-7-jre : Depends: openjdk-7-jre-headless (= 7u51-2.4.4-0ubuntu0.13.10.1) – Hunsu Mar 2 '14 at 17:12
  • please try with the switch --install-suggests; if that still doesn't fix, you could install openjdk-7-jre-headless and other dependents by hand with sudo apt-get – precise Mar 2 '14 at 17:20
-1

In Ubuntu Default Repository Every packages are too old than what we need, better we can download it from official sites and install it, me too faced several issue for installing openjdk for setting up video management server's while that time i got some points from Google after a long search i got this good solution and i have documented, you can go to oracle java

Download the 32bit or 64bit Linux "compressed binary file" - it has a ".tar.gz" file extension and uncompress it

Download JRE from Here

Download Java from here

Check the java version

# java -version

Create a Directory JVM if not available in the location

# sudo mkdir -p /usr/lib/jvm

Move the download Java to the location

# sudo mv jdk-7u51-linux-x64.tar.gz /usr/lib/jvm

Navigate to the location

# cd /usr/lib/jvm

Extract the Java om the location

# sudo tar zxvf jdk-7u51-linux-x64.tar.gz

Delete the tar file if we need are keep it for backup

# sudo rm jdk-7u51-linux-x64.tar.gz

# ls -l

# jdk1.7.0_51

Set path for java

# sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.7.0_51/bin/javac" 3

# sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.7.0_51/bin/java" 3

# sudo update-alternatives --set "javac" "/usr/lib/jvm/jdk1.7.0_51/bin/javac"

# sudo update-alternatives --set "java" "/usr/lib/jvm/jdk1.7.0_51/bin/java"

Edit the profile file and Enter the java location

# sudo vi /etc/profile

Add the following entries to the bottom of your /etc/profile file:

# JAVA_HOME=/usr/lib/jvm/jdk1.7.0_51 PATH=$PATH:$JAVA_HOME/bin export JAVA_HOME export PATH

Run the Command to update the java to run

# . /etc/profile

Check the Version of java version using command

# java -version

Please Visit here for the same information what i have posted.

| improve this answer | |
-1

I had a similar problem, during installation of eclipse. openjdk-7-jdk was required, and among packages to install, this was not found. I used

> sudo apt-get update
> sudo apt-get install eclipse eclipse-cdt

and it found openjdk. I do not mean that you install eclipse, of course, but this experience may be helpful.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.