Skip to content

Java 17 no longer part of current raspberry pi build #28

@VK1MIC

Description

@VK1MIC

Script fails using the Deb process on the current raspberry pi software - current Java version is 21.

This is my work around

Create a dummy java 17 and install java 21:

1. Optional clean up of any previous dummy packages

for PKG in openjdk-17-jdk-fake fake-openjdk17; do
if dpkg -s "$PKG" >/dev/null 2>&1; then
echo "Removing old dummy package: $PKG"
sudo dpkg -r "$PKG"
fi
done

2. Install real Java 21 and equivs

sudo apt update
sudo apt install -y openjdk-21-jdk openjdk-21-jre equivs

Quick check

java -version

3. Create a dummy package that PROVIDES openjdk-17-jdk but depends on openjdk-21-jdk

mkdir -p ~/fake-openjdk17
cd ~/fake-openjdk17

cat > openjdk-17-jdk-fake << 'EOF'
Section: misc
Priority: optional
Standards-Version: 4.5.0

Package: openjdk-17-jdk-fake
Version: 17.0-1
Maintainer: Fake Java root@localhost
Architecture: all
Depends: openjdk-21-jdk
Provides: openjdk-17-jdk
Description: Dummy package that provides openjdk-17-jdk but uses openjdk-21-jdk
This meta package is only to satisfy packages that require openjdk-17-jdk.
EOF

Build and install the dummy package

equivs-build openjdk-17-jdk-fake

sudo dpkg -i openjdk-17-jdk-fake_17.0-1_all.deb

4. Make sure java points at 21 (if multiple Javas are installed)

sudo update-alternatives --config java

Final check

java -version
echo "If you see Java 21 here, you are good to go."

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions