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!
Installing Java on Linux | Fabric Documentation
A step by step guide on how to install Java on Linux.
Stack Overflow
bash : java : command not found (Fedora)
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?...
Index - Bazzite Documentation
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.
Jump to solution
16 Replies
Solution
HikariKnight
HikariKnightβ€’3w ago
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
Index - Bazzite Documentation
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.
Ruin 🌈🐲
You can also install Prism Launcher from Discover (Flatpak) and it comes with all the versions of Java you need for Minecraft.
dreamyuki
dreamyukiβ€’3w ago
Just use prismlauncher for minecraft
Maxi
Maxiβ€’3w ago
I used rpm-ostree reset and rebooted the computer. Does this means that every package I downloaded since the last offical Bazzite update is reverted like a system-level back up? (I don't know about anything I would have installed with the terminal outside of this post, I just want to know if I understand the feature correctly.) "also is this for development or minecraft?" Minecraft, I try to make a dedicated modded Minecraft server via Fabric (a Minecraft modloader). I downloaded the .java [tpyo: it is supposed to be a .jar file] file, but the command which supposed to start it doesn't work, outputs "bash: java: command not found" message. I tried to search tutorials, and found one from the modloader's website to download Java on different distros. I didn't knew dnf doesn't exist here, thank you for the heads up, I will pay attention next time to not use it. This isn't the launcher's fault. The dedicated server and the launcher are two separate things, and I have issues running the .jar file to start up the server itself, I assume the launcher used to join the server after it runs is irrelevant.
HikariKnight
HikariKnightβ€’3w ago
dnf is just linked to rpm-ostree (mainly because people dont read documentation) if you want to run a minecraft server then i would say you can set that up inside distrobox, most minecraft servers online runs inside a similar environment make a fedora (or ubuntu) distrobox and just follow the respective guides for those distros inside the distrobox πŸ™‚
dreamyuki
dreamyukiβ€’3w ago
if you don't want container you can use openjdk from homebrew
Maxi
Maxiβ€’3w ago
Can Bazzite natively run .jar files?
Kyle Gospo
Kyle Gospoβ€’3w ago
Java is not installed OOTB It can run them if you install Java in distrobox
Maxi
Maxiβ€’3w ago
If I install java in a distrobox, can things outside of the distrobox access it, or only the things inside the distrobox?
Kyle Gospo
Kyle Gospoβ€’3w ago
Define access Really depends
Maxi
Maxiβ€’3w ago
Should I run the server itself inside the same distrobox where I installed java, or can the server run on Bazzite itself? (I'm good with both options, I don't know if there is a difference, I will do the better/possible way.)
Kyle Gospo
Kyle Gospoβ€’3w ago
Distrobox isn't a VM, running a server out of distrobox is running it on Bazzite Containers are extremely common in the server world
Maxi
Maxiβ€’3w ago
I need to read more about this to understand better (this is the first time I will use distrobox). I'll try to make one and install java and the server in it, thank you for the help, I'll mark the post as solved. πŸ™‚
Rin
Rinβ€’3w ago
homebrew was enough for MC servers from what I tested brew install openjdk@17
asen23
asen23β€’3w ago
https://docker-minecraft-server.readthedocs.io/en/latest/ using container for server is also good alternative
Minecraft Server on Docker (Java Edition)
Documentation for Minecraft Server on Docker
Want results from more Discord servers?
Add your server