5
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package openjdk-7-jre-headless is a virtual package provided by:
  oracle-java9-installer 9b130+9b130arm-1~webupd8~0
  oracle-java8-installer 8u101+8u101arm-1~webupd8~2
  oracle-java7-installer 7u80+7u60arm-0~webupd8~1
You should explicitly select one to install.

E: Package 'openjdk-7-jre-headless' has no installation candidate

I'm not sure how to "explicitly select one to install". How do I do that?

karel
  • 122,292
  • 133
  • 301
  • 332

2 Answers2

8

You should explicitly select one to install. means you need to issue command to install 1 of the 3 suggested packages, which provide similar functionality of openjdk-7-jre-headless which is currently unavailable. You can issue command like these

sudo apt install oracle-java9-installer or
sudo apt install oracle-java8-installer or
sudo apt install oracle-java7-installer


As a note, you should know that, there is no component of OpenJDK-7 in xenial release and therefore openjdk-7-jre-headless package is non-existent. See here http://packages.ubuntu.com/search?keywords=openjdk-7-jre. OpenJDK-7 has been dropped in the latest LTS and you need to install openjdk-8 or openjdk-9 to use openjdk (in contrast to Oracle JDK)

I suggest using openjdk-8 instead and replace all the packages containing name openjdk-7 with openjdk-8 and proceed with installation. This will resolve the issue for Xenial.

If you really want to stay with OpenJDK 7, Look at this question

Anwar
  • 77,855
0

Found the solution from:

Can't install Oracle Java 8 in Ubuntu 16.04

This problem occured again, because version 151 has been archived. This version is referenced currently by the PPA. You can use the following commands to update the reference to 161:

sudo sed -i 's|JAVA_VERSION=8u151|JAVA_VERSION=8u161|' oracle-java8-installer.*
sudo sed -i 's|PARTNER_URL=http://download.oracle.com/otn-pub/java/jdk/8u151-b12/e758a0de34e24606bca991d704f6dcbf/|PARTNER_URL=http://download.oracle.com/otn-pub/java/jdk/8u161-b12/2f38c3b165be4555a1fa6e98c45e0808/|' oracle-java8-installer.*
sudo sed -i 's|SHA256SUM_TGZ="c78200ce409367b296ec39be4427f020e2c585470c4eed01021feada576f027f"|SHA256SUM_TGZ="6dbc56a0e3310b69e91bb64db63a485bd7b6a8083f08e48047276380a0e2021e"|' oracle-java8-installer.*
sudo sed -i 's|J_DIR=jdk1.8.0_151|J_DIR=jdk1.8.0_161|' oracle-java8-installer.*
Eliah Kagan
  • 119,640
notilas
  • 101