nus-cs2103-AY2425S1 / forum

12 stars 0 forks source link

Bumping JavaFX version (17.0.7 -> 22.0.1) for stability in wayland #593

Open yadobler opened 3 days ago

yadobler commented 3 days ago

I'm using Wayland on Linux:

OS: NixOS 24.11.20240906.574d1ea (Vicuna) x86_64
Host: HP 8940 
Kernel: 6.6.49 
Shell: zsh 5.9 
DE: hyprland (Wayland) 

Right now the current setup for AB3-forked projects use version 17.0.7 as defined in the build.gradle file. However, this means the menu-bar in the javafx application does not work (clicking it will make the menu flash and disappear).

If javaFxVersion is edited to be 22.0.1 instead, the menu bar works: image

(it is still buggy though - I can move the main window with the opened menu stuck in place but that is javafx issue)

are we allowed to either:

  1. change the global javaFxVersion to 22.0.1
  2. set the version for the linux groups for the components separately to 22.0.1
  3. just ignore and hope no one uses wayland on linux

Note: using GDK_BACKEND=x11 does not fix this issue

damithc commented 2 days ago

@yadobler For someone using Linux waylaid, what's the impact of this problem? Can the app be used as per normal, provided the help menu is left alone?

yadobler commented 2 days ago

@damithc yup it is possible to use it as normal (ignoring the menubar issue).

I have not tried i18n input yet, but I believe it might also be a problem with wayland (as seen in electron apps) - it is fixable by setting some env vars (see below), in particular the gtk one.

I think the only main caveat is openjfx needs to be installed in addition to openjdk (for java >= 11).


Depending on the system, _JAVA_AWT_WM_NONREPARENTING needs to be set.

I think this is not wayland or jfx related, it's a more broader problem with java and Linux (and how java reacts to different DEs) - this issue pops up when trying to run native java apps like ArduinoIDE and even IntelliJ. It might be related to swing.


I18n fixes:

QT_QPA_PLATFORM=wayland
GTK_IM_MODULE=fcitx
QT_IM_MODULE=fcitx
SDL_IM_MODULE=fcitx
XMODIFIERS="@im=fcitx" 
damithc commented 2 days ago

I see. Thanks for the investigation @yadobler We can add these details to https://se-education.org/guides/tutorials/javaInstallationLinux.html if a Linux users sends a PR. As for the tP, we can assume that Linux users are aware of these problems and already know how to fix them. If the team chooses to (not required to), they can also mention this as a 'known issue' in the UG. Do you think the above is sufficient?

yadobler commented 1 day ago

I think it is great for ubuntu / Debian users, which should cover most uses.

I am comparing it to the arch linux wiki for java, which is overly comprehensive but targeted to arch / pacman package management / manual installation.

And I feel if anyone's using arch, they are competent enough to figure out how to get their system working

So I think it might be alright


The only issue is that openjfx 17 does not natively support wayland, so the xwayland fallback is very buggy. V21 onwards apparently is supposed to solve this.

I know there's an active development by Oracle (project Wakefield) to natively support wayland.

For now javafx 17 works fine, unless trying to open the menu.