r/JavaFX • • Oct 24 '26

Discussion JavaFX and full Wayland support, when?

It's unfortunate that Flatpak is phasing out apps that use both X11 and Wayland.

Since JavaFX doesn't fully support Wayland yet, most JavaFX applications risk being removed from Flathub or having their updates halted.

The way I see it, the lack of Wayland support will spell total failure for JavaFX in the short term.

Oracle, are you interested in adding official support for Wayland or not?

21 Upvotes

15 comments sorted by

6

u/malachireformed Oct 24 '26

Wouldn't Wakefield fix this though? Or was that for Swing/Awt only?

3

u/emberko Oct 25 '26

No, Wakefield won’t fix this. AWT uses Java2D for rendering (that's why its more lightweigt comparing to JavaFX -- no scene graph) and XToolkit for window management. Wakefield implements WLToolkit as a Wayland alternative to XToolkit. JavaFX uses Prism (OpenGL/ES2) for rendering and Glass/GTK3 for window management, so it doesn’t benefit from Wakefield.

3

u/Wootery Oct 25 '26

JavaFX uses Prism (OpenGL/ES2) for rendering and Glass/GTK3 for window management

I must be missing something, why doesn't JavaFX get full Wayland support 'for free' courtesy of GTK?

5

u/emberko Oct 25 '26 edited Oct 25 '26

GTK supports Wayland protocol, but Glass (JavaFX backend for Linux) initializes JavaFX in X11 mode. There is more to it. When Prism uses the window provided by Glass (GTK) to draw the app content, it creates an associated OpenGL (renderer) context for it. To work with OpenGL, Prism uses the GLX API, which supports only X11. To work natively with Wayland, Prism would have to switch to EGL, which supports both X11 and Wayland. The PR is already here. Also, because Wayland is merely a protocol and deliberately restricts things like screen capture and input injection, JavaFX would need to support xdg-desktop-portal for screen grabbing and the Robot API. None of this is free, but it’s arguably simpler than what AWT had to do. Since AWT XToolkit talks to X11 "directly", Wakefield had to implement a native Wayland client with its own toolkit and window peers, whereas JavaFX can delegate the Wayland protocol to GTK.

2

u/Wootery Oct 25 '26

Interesting, thanks.

5

u/revilo-1988 Oct 25 '26

Isn't that Gluon's problem now? With OpenFX, Oracle seems to want nothing more to do with it.

6

u/lazystone Oct 25 '26

Not really, since Oracle included JavaFX into their portfolio this year, there they advertised support and commitment:

https://www.oracle.com/java/technologies/downloads/jvp/

5

u/revilo-1988 Oct 25 '26

Ah, I missed that. Thanks for the info and source. We're curious to see if they improve Wayland support and generally optimize FX.

8

u/emberko Oct 25 '26

To answer your question:

  • Almost entire modern Linux support is contributed by a single community dev (Thiago Sayao), who ported it from GTK2 to GTK3 and solved numerous other issues (https://github.com/openjdk/jfx/pulls?q=author%3A+tsayao).
  • Oracle is Kevin Rushforth (the lead and the owner of the Merge button, who doesn't write any code), a group of Indian devs (who are only allowed to edit copyright headers and version strings, which speaks for their skills better than anything else could) and Andy. Andy is the only Oracle employee who actually pushes the framework forwards. He writes code by the boatload, reviews others' code, and seems to have 30 hours in a day, but (tough luck) he isn't a Linux guy.
  • Gluon lives in another galaxy, where they have been conspiring to rule the world of mobile development for the last 15 years, but it never goes past big announcements. By that time, several new frameworks have appeared that actually do rule the world of mobile development. I'm very curious how they still exist. Apparently someone pays them for GluonFX, but they must be taking them as hostages — that's the only explanation.

So, Wayland support is entirely up to the community, but when it ever gets merged, they will surely mention it at the last summit as something of their own merit (like they always do, never referencing the original contributors). I believe this is what they call "stewardship".

4

u/lazystone Oct 25 '26 edited Oct 28 '26

/u/brian_goetz I know that it's probably not your area, but you hopefully do have enough influence to kick some a$$ in Oracle and finally make it clear what is the future of JavaFX? Is there any future at all, is it going to be evolved or sent to farm put into maintenance mode, or maybe it will come back to be a part of the JDK as a module, so that installation/distribute hell is finally over?..

There are too many unanswered questions about JavaFX for too many years(and including JavaFX into JVP does not answer any really).

2

u/Siedlerchr Oct 27 '26

Yeah, I fully agree with you about Gluon... Then there's also Marius, who has been fixing a lot of longstanding bugs in JavaFX and is really pusing forward

1

u/nogridbag 26d ago

I'm also really interested in this. We're in an interesting point in time where I think there's a strong push towards desktop Linux. And for better or worse, people are leveraging AI to build apps that previously were Windows only. Personally I would have already switched to Linux if laptop prices weren't so steep.

I've been doing backend Java dev for a very long time, but I started my career doing Swing and I love UI development. I have Fedora Workstation running in UTM on Mac. The other day I tried using Gemini to scaffold a JavaFX project that would integrate well into Gnome and that's when I found out it doesn't support Wayland. At the most basic level it cannot easily honor the OS light/dark mode without some hacky workaround.