How to install openjdk-17-jdk in Debian 12 (bookworm)?

Programming languages, Coding, executables, and scripting.
Post Reply
Message
Author
_Artur-
Posts: 12
Joined: 2019-07-01 19:54

How to install openjdk-17-jdk in Debian 12 (bookworm)?

#1 Post by _Artur- »

Hi,

I updated system using "apt update && apt upgrade", then issued command "apt install openjdk-17-jdk" and it returned an error:

Code: Select all

The following packages have unmet dependencies:
 openjdk-17-jre-headless : Depends: ca-certificates-java (>= 20190405~) but it is not installable
E: Unable to correct problems, you have held broken packages.
Package "ca-certificates-java" status is:

Code: Select all

# apt-cache policy ca-certificates-java
ca-certificates-java:
  Installed: (none)
  Candidate: (none)
  Version table:
     20190909 -30000
        500 http://ftp.pl.debian.org/debian bookworm/main amd64 Packages
        500 http://ftp.pl.debian.org/debian bookworm/main i386 Packages
But the package exists on a page "https://packages.debian.org/bookworm/ca ... cates-java". So why it does not have a candidate to install? Do I need to add something to sources.list? There is current content:

Code: Select all

# cat /etc/apt/sources.list
deb http://ftp.pl.debian.org/debian/ bookworm main contrib non-free
deb-src http://ftp.pl.debian.org/debian/ bookworm main contrib non-free

deb http://security.debian.org/ bookworm-security main contrib non-free
deb-src http://security.debian.org/ bookworm-security main contrib non-free
Directory "/etc/apt/sources.list.d/" is empty.

FIrst time I tried to install OpenJDK about a week or two ago, same error happened. I though this is temporarily broken package, but it looks persistent.

What can I do to install OpenJDK 17?

arochester
Global Moderator
Global Moderator
Posts: 2211
Joined: 2010-12-07 19:55
Has thanked: 7 times
Been thanked: 17 times

Re: How to install openjdk-17-jdk in Debian 12 (bookworm)?

#2 Post by arochester »

E: Unable to correct problems, you have held broken packages.
You need to fix broken packages. https://linuxhint.com/apt_get_fix_missi ... _packages/

_Artur-
Posts: 12
Joined: 2019-07-01 19:54

Re: How to install openjdk-17-jdk in Debian 12 (bookworm)?

#3 Post by _Artur- »

Nothing from this page helps. What I did is here:

apt install openjdk-17-jdk
apt-get update --fix-missing
apt-get install -f
apt install openjdk-17-jdk
apt-get update
apt-get clean
apt-get autoremove

Next step did not seem to be correct, because problematic packages weren't installed, but I executed it anyway:
dpkg --remove --force-remove-reinstreq openjdk-17-jdk
dpkg --remove --force-remove-reinstreq ca-certificates-java
Of course it responded:
dpkg: warning: ignoring request to remove openjdk-17-jdk which isn't installed
dpkg: warning: ignoring request to remove ca-certificates-java which isn't installed

Next attempt tp fix package errors:
dpkg --configure -a

Again, removing won't help because package is not installed, but anyway:
apt remove openjdk-17-jdk
apt clean
apt update


The root of the problem seems to be "no installation candidate", which is wrong, because package exists:
https://packages.debian.org/bookworm/ca ... cates-java

If I try to install it:

root@P7730:~# apt install ca-certificates-java
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package ca-certificates-java is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'ca-certificates-java' has no installation candidate

_Artur-
Posts: 12
Joined: 2019-07-01 19:54

Re: How to install openjdk-17-jdk in Debian 12 (bookworm)?

#4 Post by _Artur- »

Package apt-listbugs blocked installation, after "apt purge apt-listbugs" installation of openjdk-17-jdk succeeds.

Post Reply