Search code examples
javaxul

Communicating between XUL and Java


I would like to use a mixture of Java and XUL for my next project.

I want to build the GUI in XUL, but I need certain Java libraries for the business logic.

What options are available for communicating between Java and XUL? I've googled the topic a bit, and there doesn't seem to be a clear best practice for this.


Solution

  • There aren't exactly lots of options:

    • You can put an invisible Java applet into a XUL document somewhere and communicate with that applet from JavaScript.
    • You can run a Java application via nsIProcess and communicate with it via TCP sockets.

    The first solution seems simpler but it is also more error-prone as some questions here show.