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?

  • 1
    Why not openjdk-8? openjdk-7 is obsolete. – Pilot6 Feb 13 '17 at 13:29
  • I want to build android-6.0.1 and it requires "1.7.x" – hadilq Feb 13 '17 at 13:32
  • The easiest way is to install a virtual machine for that. – Pilot6 Feb 13 '17 at 15:22

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:


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

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

  • 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 5:51
  • If it shows dependency problem use command: sudo apt-get install -f – I am Dev Feb 14 '17 at 6: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 7: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' – I am Dev Feb 14 '17 at 12:00
  • It didn't work. The same as before! – hadilq Feb 14 '17 at 13:01

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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