What they should have done instead is create a backend restful web service and wire up a frontend rest client with something suited to web app ui dev such as angular or react.
If anon’s program was designed to work as a client for some external server or if Java had absolutely no GUI frameworks, that would be fine. But if anon’s goal was to create a simple desktop application, doing this would be the programming equivalent of a Rube Goldberg machine.
With that approach, you also need to be really careful about how you do it. Fuck that part up and you can end up with the locally-hosted REST server listening on the device’s public network interface or vulnerable to CSRF from a web page opened in the user’s browser.
That’s entirely the fault of applications (or more likely their libraries) using internal APIs or JNI. As long as it isn’t doing anything screwy with reflection and class loading or using the
sun.*
packages that aren’t part of the language specification, Java bytecode compiled for ancient Java versions will still work on modern versions.