Coming from the Ubuntu and Arch ecosystems, I was attracted to the Wayland-only approach of Fedora 40 KDE. I am aware that Wayland cannot fully replace X11 yet, but I was shocked to discover that it cannot even run Java graphical applications! Attempting to run a couple of typical jar files with java -jar filename, I got the following error:
Exception in thread "main" java.awt.HeadlessException: No X11 DISPLAY variable was set, or no heaadful library support was found, but this program performed an operation which requires it.
Fedora 40 comes with OpenJDK Runtime 21.0.2 preinstalled, and “Wayland to X11 Video bridge” is active to the tray. Has anyone faced the same issue? How about Project Wakefield, the Wayland JDK? Any experience with compiling it and using it?
I frequently run my java apps on my Fedora 40 system, some are GUI based and work fine. A lot are even old, written over a decade ago for a couple. It seems from the erorr that you have the headless java installed, you may need the actual full JDK installed. Try a dnf search openjdk to get a list of the openjdk packages available and install the appropriate one for you.
Hi Stephen,
Thank you for your reply, you were right. I installed the full Java-21-OpenJDK, and now jar files are running smoothly through the terminal. However, to run a jar file through the GUI, I had to manually create an OpenJDK desktop entry. Do you have any idea why it was not auto-created after the OpenJDK installation?
Regards,
Jordan
I don’t understand why it would be. Perhaps you could enlighten me on that. It is after all a command line usage tool the java runtime, and has many options.