Alternatives command not working while installing Java

Hi!

I currently have a problem with java and creating a link to it in my server. The command alternatives is not doing what I want it to do.

At the moment I have this:

but my java should link to /usr/lib/jvm/java-1.8.0/bin/java and everytime I try to mess with it I get this error: /usr/lib/jvm/java-1.8.0/bin/java exists and it is not a symlink.

My installation worked fine on my centos before migrating it onto my rocky. Not sure about what to do about it, any help is appreciated!

Hello,
after migrating a centos 8.4 virtual machine to rocky 8.4 with the official script, i had to uninstall the openjdk rpm package and reinstall openjdk with dnf to correctly recreate the alternatives and fix the “java” symbolic links in /usr/bin.
regards,

I had to an alternatives --remove-all java beforehand but thanks a lot!