Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

java desktop app gui in html5/JS

can I create Gui in html5/JS for the desktop java application. If yes, what tools I need and how would I connect GUI with java code?

like image 951
Ramy Avatar asked Nov 04 '22 19:11

Ramy


1 Answers

Possible - but not entirely sure why you'd want to do that.

Your main options would be:

  • Have the Java application act as a local web server and connect to it with a browser. Would be a wierd design but fairly easy to make it work. It's essentially the same as you would do if you had a remote Java web server so the components are pretty standard - you could use a toolkit like Vaadin for example.
  • Run JavaScript within a Java hosted environment / embedded browser. Should be possible with Rhino - though I must admit I haven't ever seen this approach used to build a desktop GUI

The first option in particular might make sense if you were considering using the application remotely at some point in the future.

Overall though, I'm still not sure if this is a good idea. The JavaScript web frameworks still aren't IMHO as good as the native Java ones (SWT, Swing or JavaFX) for building local desktop application GUIs.

like image 94
mikera Avatar answered Nov 12 '22 16:11

mikera