Report this

What is the reason for this report?

Unable to install Jenkins due to java package can not be installed

Posted on March 15, 2021

Hi,

When I tried to install Java package that is required for Jenkins install I see the following error and there is no clue how to get unblocked from this error. OS on the droplet is Ubuntu 18.04.


$ sudo apt install default-jre
Reading package lists... Done
Building dependency tree       
Reading state information... Done
**E: Unable to locate package default-jre**
 
$ java --version

Command 'java' not found, but can be installed with:

sudo apt install openjdk-11-jre-headless  # version 11.0.7+10-2ubuntu2~19.10, or
sudo apt install default-jre              # version 2:1.11-72
sudo apt install openjdk-13-jre-headless  # version 13+33-1
sudo apt install openjdk-14-jre-headless  # version 14~18-1
sudo apt install openjdk-8-jre-headless   # version 8u252-b09-1~19.10

$ sudo apt install openjdk-11-jre-headless
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package openjdk-11-jre-headless
$ 
$ sudo apt install   openjdk-14-jre-headless
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package openjdk-14-jre-headless
$ 
$ sudo apt openjdk-8-jre-headless
E: Invalid operation openjdk-8-jre-headless
$ 



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hi @bengaltiger,

The easiest option for installing Java is to use the version packaged with Ubuntu. By default, Ubuntu 18.04 includes OpenJDK version 11, which is an open-source variant of the JRE and JDK.

To install this version, first update the package index:

sudo apt update

After the update give

sudo apt install default-jre

Another try

Regards, KFSys

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.