2

I tried this answer for Ubuntu 16.10, but after running this

 sudo apt-get update

This error happened

 Reading package lists... Done
 W: The repository 'http://ppa.launchpad.net/openjdk-r/ppa/ubuntu yakkety Release' does not have a Release file.
 N: Data from such a repository can't be authenticated and is   therefore potentially dangerous to use.
 N: See apt-secure(8) manpage for repository creation and user configuration details.
 E: Failed to fetch http://ppa.launchpad.net/openjdk-r/ppa/ubuntu/dists/yakkety/main/binary-amd64/Packages  404  Not Found
 E: Some index files failed to download. They have been ignored, or old ones used instead.

And after trying to install it

sudo apt-get install openjdk-7-jdk

This error occurred

E: Package 'openjdk-7-jdk' has no installation candidate

How can I install openjdk-7 on Ubuntu 16.10?

hadilq
  • 161

2 Answers2

3

I followed I am Dev's answer with the addition of downloading other dependencies manually. In total I had to download following packages off the Debian page:

libjpeg62-turbo_1.5.1-2_amd64.deb
openjdk-7-jre-headless_7u121-2.6.8-2_amd64.deb
openjdk-7-jre_7u121-2.6.8-2_amd64.deb
openjdk-7-jdk_7u121-2.6.8-2_amd64.deb

And install them with

sudo dpkg -i <deb file>

Whenever the installation complains about missing dependencies, you can run

sudo apt-get install -f

to resolve them unless the dependency is one of the downloaded packages. In that case, you just have to install those first with dpkg.

Should you already have a Java version installed, you can select the OpenJDK binaries using

sudo update-alternatives --config java
sudo update-alternatives --config javac
antweb
  • 131
  • 4
  • Nowadays (2022) I've found openjdk-7-jdk at http://security.ubuntu.com/ubuntu/pool/main/o/openjdk-7/ – Erhannis Feb 08 '22 at 23:54
1

Download .deb file from below link https://packages.debian.org/experimental/amd64/openjdk-7-jdk/download by selecting mirror. then type ccommand sudo dpkg -i openjdk-7-jdk_7u121-2.6.8-2_amd64.deb

Dev
  • 176
  • This command is not installing dependencies. The error is: "Package openjdk-7-jre is not installed." Then I tried to install openjdk-7-jre and similar error appeared: "Package openjdk-7-jre-headless is not installed. Package libjpeg62-turbo is not installed. Package libatk-wrapper-java-jni is not installed." Should I continue to download every dependencies manually? – hadilq Feb 14 '17 at 05:51
  • If it shows dependency problem use command: sudo apt-get install -f – Dev Feb 14 '17 at 06:46
  • It brings me back before running dpkg command!! It says: "... The following packages were automatically installed and are no longer required: ... The following packages will be REMOVED: openjdk-7-jdk openjdk-7-jre ..." – hadilq Feb 14 '17 at 07:38
  • first clean the cache. try 'sudo apt-get autoclean && sudo apt-get clean' then 'sudo apt-get update && sudo apt-get upgrade' after that install above .deb file. If it shows dependency problem then run 'sudo apt-get install -f' – Dev Feb 14 '17 at 12:00
  • It didn't work. The same as before! – hadilq Feb 14 '17 at 13:01