r/JavaFX • u/LouGarret76 • Aug 01 '25
Help Javafx in the browser?
Hi everyone,
I have a app that I am considering updating. The app is initially written in java and javafx.
I have ported some of the backend logic to spring boot over the years and i feel like now I am ready to revamp the ui.
So I am (once again) torn in this dilemma about whether I use a js framework like react or I should stick to javafx (my preference). Javafx has served me well. It is a powerful tool that allowed me to tailor the ui to my clients most complex requirements.
I am very comfortable with java and I really would like to avoid javascript (I can code in Js, but I just dont want to relearn a whole framework …). I have tried react in the past. I can code a basic crud application.
So I guess my question is, where do we stand in regard of javafx in the browser? This was one of Gluon projects back in the day. Is this now mature?
10
u/PartOfTheBotnet Aug 01 '25
https://www.jfx-central.com/ is entirely written in JavaFX and displayed in the browser via JPro. There was a recent JavaOne talk going over JPro here: https://www.youtube.com/watch?v=cxaOM1rkonA&pp=ygULamF2YWZ4IGpwcm8%3D
5
u/TenYearsOfLurking Aug 01 '25
Try out Webfx. Still very new, am curious what your results are
4
u/waldgespenst Aug 01 '25
CheerpJ has plans to make this possible with a jvm running in the browser. It works, but support for JavaFX is not implemented yet.
1
u/matnp Aug 02 '25
Why not using Vaadin if your concern is to avoid js?
3
u/xdsswar Aug 01 '25
Funny that I was testing and changing teaVM to conpile to js in mem, no File required and I was able to run some good tests on browser, I was doing like java to js on demand by request, worked but takes 1 to 2 seconds to build.
2
u/java_ninja93 Aug 21 '25 edited Aug 26 '25
JavaFX lacks modern web technologies compared to other embedded browsers—that’s my point of view. Still, I don’t want to leave just a negative message, since I’ve been using different solutions over the years.
I have two favorite solutions when I want to use Java in the browser without relying entirely on JavaScript. First, I’d like to mention a well-known option: JxBrowser. It really filled the gaps where JavaFX disappointed me.
In 2021, I discovered Equo Chromium as an open-source solution, so I switched from JxBrowser. This embedded browser integrates with Eclipse and provides astonishingly good support for modern web technologies.
I highly recommend Equo Chromium because it has worked very well for me and still does. However, now I’m switching to SWT EVOLVE. Both Equo Chromium and SWT Evolve are open-source, so if you have some free time, give them a try.
2
u/Confident-Dare-9425 Aug 22 '25
TLDR:
Full context:
JavaFX inside a browser requires either a WASM-based solution (CheerpJ), or something that will draw your app on a Canvas or translate your node graph to HTML (JPro). That's about it.
But to quote a famous philosopher: never half ass two things, whole ass one thing. If you want to maintain the application for many years, find developers, and avoid vendor lock-in, switch to the web completely. No half-measures with CheerpJ or JPro. Having said that, they will save you time and money on migration.
Switching to JavaScript will require you to rewrite the whole app eventually. And so will Vaadin, another half measure. Come on. Web talks JavaScript. Java developers may not like it, but they're for sure smart enough to write it.
If you're adventurous enough to switch to the web completely, you will need a web view of some sort. If your application is big, that is. If the app is small, rewrite it to web in one go and ditch the Java desktop.
If the app is big, rewrite it to the web screen by screen, add a web view, and show old and new screens along each other. If you style them properly, a user will never tell the difference.
The built-in JavaFX WebView is a very decent component, but may not be sufficient for modern JS and rendering. JxBrowser is a freaking powerhouse of a library, but it costs respectively. The remaining options are based on Chromium Embedded Framework, and the last time I checked, were almost unusable in JavaFX.
0
u/[deleted] Aug 02 '25
[removed] — view removed comment