Where does "sudo dnf install java-21-openjdk" install java? (to solve bash: java: command not found)

I tried to install java based on this: https://docs.fabricmc.net/players/installing-java/linux

I ran these three commands, and it seemingly downloaded something, but I don't know if it is installed properly or not:
sudo dnf install java-21-openjdk
sudo dnf install java-21-openjdk-devel
sudo dnf install java-17-openjdk-devel
It also wrote two errors: "Previously interrupted while targeting commit <long characters>, cannot change target to <other long characters>"

I want to find them, to delete the two unnecessary ones (I don't know yet which I need, I want to make a dedicated fabric MC server), and do this <below link> dark magic I don't know what is exactly but I assume it will solve the "bash: java: command not found" issue once I understand what I have to do with it. (If I understand correctly to run the java command it has to know where the 'java' is.)
https://stackoverflow.com/questions/71928993/bash-java-command-not-found-fedora

I don't know if it matters or not, but a flatpack Modrinth (using Gear Lever) downloaded java 17 into it's own foldernest, I don't know if it messes up things or not. (It also doesn't launch the modpack I made, when started it crashes, when I would open the log window of Modrinth it freezes and crashes, I don't know where it saves the crashes, but this is an unrelated separate problem I have to figure out.)

Thanks for the help!
A step by step guide on how to install Java on Linux.
Stack Overflow
On Fedora I installed (or at least tried to install) JDK-18. I rebooted my laptop and wanted to check if it succeeded. I used java --version, but it said bash : java : command not found.
Solution
firstly dnf does not exist on fedora atomic and is just a link to rpm-ostree
secondly using rpm-ostree to install something should be your absolute last resort since it massively slows down your updates.
you can uninstall what you layered with rpm-ostree using rpm-ostree uninstall packagename or you can remove all your installed layers with rpm-ostree reset

also is this for development or minecraft?

if development, use distrobox/boxbuddy and install java in there, along with your tools

if minecraft then use prism launcher (beyond that i cant help as i do not play minecraft, but this is where most people seem to "need to install java on the system")

lastly, did you know that there is even documentation that mentions how to install stuff in bazzite? it is mentioned right under the download button
https://ublue-os.github.io/bazzite/Installing_and_Managing_Software/

also if you use an appimage and it downloads its own java to use, we do not know what the appimage will do but i doubt it will install it on the actual system, bigger chance it just dumps it somewhere in your home folder where it can look for it and use it when needed.

flatpaks are self contained so if they download java, it is stored within their directory in ~/.var/app the ~ being your homedirectory
Bazzite is a custom image built upon Fedora Atomic Desktops that brings the best of Linux gaming to all of your devices - including your favorite handheld.
Was this page helpful?