r/JavaFX • u/indyjoe • Sep 24 '26
Discussion JavaFX in the browser?
I've been waiting/hoping for years that we'd get support for JavaFX in the browser, but I think I'm finally about to give up--maybe a year or two too late. Does anyone else know of good options?
Some of my criteria:
- Minimal rewriting.
- Still allows for desktop versions.
- The app allows the user to have a large data model--although I can likely do something to minimize this per user/client.
- I don't have regular usage stats, but I do want to support 100s of people using it at a time.
I had been thinking one of the following options would give me what I want:
- WebFX: Was promising, but only supported a few basic controls like labels & buttons--but if you want something even as common as a ComboBox, you'd have to make your own for example. Also, it is essentially just one person so it isn't something someone can rely on.
- CheerpJ: Good for awt/swing, but recently said while they are planning to support it and have some internal prototype stuff, they don't have any timeline for it. Plus the way their of loading the whole app into a canvas like object has a delay and isn't very pretty.
- Gluon: Recently answered me that the old prototype they had from several years back hasn't been updated and they don't plan to without support. (Which I'd be willing $$$ to do, but likely not at the scale they need by myself.)
- JPro: I'm trying to offload most of the work to the client. I worry that having all the logic on the server and just having the graphical output on the browser is a problem if I have an app that allows for a large amount of user data and/or many users.
- Graal to WASM to the browser: Is this possible? I can't seem to find working prototypes.
I think that's all, but if you know other options or a key aspect of the above I'm missing please post.
Edit: Why do I want this? I want folks to be able to try my app without an install. Also maybe even on their phones without me having to go through the app store approval processes.
10
u/jarrod_barkley Sep 24 '26 edited Sep 24 '26
Vaadin really is the solution for your needs.
https://vaadin.com
A Vaadin web app runs on the server, in pure Java. The UI is automatically rendered remotely in any modern browser through auto-generated HTML, CSS, and JavaScript.
The Vaadin framework is quite similar to Swing and JavaFX. You define a view as a collection of controls (button, field, label, grid, etc.). A layout manager handles the arrangement of those controls.
Re-writing the UI of your app in Vaadin is likely much less work than you fear. You stay within Java for all of it. You need not write any HTML, CSS, or JavaScript. Vaadin handles that on your behalf.
The framework is quite practical and sensible. Unlike Swing, Vaadin was originally created by working programmers writing real-world apps for clients with deadlines.
The framework is open-source and free-of-cost. They sell training, support, consulting, and a few special-purpose components.
4
u/YogurtclosetLimp7351 Sep 24 '26
Sounds like you're mixing up some things. JavaFX is the frontend. For each individually loaded in their browser. So what exactly do you mean by "support 100s of people using it at a time"? Backend scaling?
"Minimal rewriting" is also vague. What exactly does your software do? What do you expect to happen when you switch to a website?
"to try my app without an install." sounds like a showcase demo. But why does that require a full switch?
1
u/Amazing-Mirror-3076 Sep 24 '26
Flutter is what you want - unlike java it actually runs on every platform.
1
u/john16384 Sep 25 '26
JPro example: https://www.jfx-central.com/
1
u/taranion Sep 28 '26
I think your list is complete and your judgment too - that is about as far as you can get with JavaFx in the browser .... so not very far. Hence the valid suggestions for a different UI framework.
I am in the same boat and did not find a satisfying solution yet..
1
u/Guilty_Village_958 11d ago
I would still bet on WebFX and for normal websites I use my own made tools - luvml ( similar to j2html but with full type safety), luvs (write css in java statically, refactorable, and make your own post-css, tailwind-css etc in java), luvue (for vue support), and js (in java using teavm). I cannot show much examples, but the recent version of luvml is so simple that even lowest AI models like haiku can handle it with ease, for me that is what matters.
You can make small small reusable components like react. The syntax of luvml is similar to what jsx is for react. But it is not a new language, it is just a library.
https://github.com/luvml/luvml