6

Currently there is no possibility to install java-17-openjdk through sudo yum install java-17-openjdk on a CentOS 7 system (CentOS Linux release 7.9.2009 (Core)) as it was possible some time ago. When I now search for other openjdk versions, I can find the packages

java-1.6.0-openjdk
java-1.7.0-openjdk
java-1.8.0-openjdk
java-11-openjdk
java-latest-openjdk (OpenJDK 18)

Also looking at https://rpmfind.net/linux/rpm2html/search.php?query=java-17-openjdk I cannot find an entry for CentOS 7.

I need OpenJDK 17. Is there some possibility to install it through a rpm package or any other alternative?

MrPython
  • 81
  • 2
  • 5
  • You may always download the JDK, unpack it to a certain folder, and update all needed Environment-Variables to make it work. Does it have to be installed via a package? – gerhard d. May 23 '22 at 10:19
  • 2
    I don't know which environment variables has to be changed and which values they need. – MrPython May 23 '22 at 10:40

1 Answers1

2

You might simply build this yourself. If it worked before, chances are the build for Fedora works. You will need a Fedora 34+ host to cross-build this.

# Don't build as root. Only need root privileges to install `fedpkg`,
sudo dnf install -y fedpkg

# Now get the package description
git clone https://src.fedoraproject.org/rpms/java-17-openjdk
# Use fedpkg to kick off a mock build
cd java-17-openjdk
fedpkg mockbuild --root centos-7-x86_64

This will take a while¹; and in the end, you should be getting a line that tells you where the RPMs you've just built were put.


¹ mock sets up a chroot, in which it installs a CentOS 7 base system, then EPEL, which you'll almost certainly will need, I think, then the tools necessary to build any RPM, then the build-time dependencies of the java-17-openjdk package. Then it will download all the necessary source code, hand off to rpm-build to do the build, which includes applying all patches, then compiling OpenJDK, then, running the OpenJDK installation, collecting the installed files, compressing them into valid RPMs.

Marcus Müller
  • 21,602
  • 2
  • 39
  • 54