To install Java on AlmaLinux, first make sure your system is fully updated:
dnf -y update
Install EPEL if you don't already have it:
dnf install -y epel-release
If you want the latest rolling release of Java, run:
dnf install -y java-latest-openjdk
Otherwise, for Java 8 (which is available in appstream):
dnf install -y java-1.8.0-openjdk
Other Java versions are available too such as version 11 and 17.