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?

4
  • maybe this stackoverflow.com/questions/10471564/… is giving you the right direction to resolve your problem
    – 0x0C4
    Aug 13, 2016 at 6:38
  • 1
    Which command did you issue? Also, since you are trying to install Oracle Java from webupd8 ppa, the command you need to issue is: sudo apt-get install oracle-java7-installer for Java version 7 or sudo apt-get install oracle-java8-installer for Java version 8 or sudo apt-get install oracle-java9-installer for Java version 9.
    – Raphael
    Aug 13, 2016 at 6:45
  • " sudo apt-get install git openjdk-7-jre-headless tar " spigotmc.org/wiki/buildtools/#linux i'm 99% sure java is already installed. what i'm trying to get is build tools from spiggot
    – Bryophyte
    Aug 13, 2016 at 7:19
  • Do what the message says: sudo apt-get install oracle-java8-installer Replace java8 with 7 or 9 as you want.
    – Ron
    Aug 13, 2016 at 10:26

2 Answers 2

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

2
  • This didn't work for me. I installed one and I still got the same prompt. Oct 12, 2017 at 10:45
  • @TimothySwan this depends on the packager and packages being available on ubuntu. Try to use java8 or 9 instead.
    – Anwar
    Oct 12, 2017 at 12:54
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.*

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .