I would like to implement a command line interface for a Java application. This wouldn’t be too difficult to do, except I would like the command line program to affect the state of another Java GUI program. So for example, I could type:
java CliMain arg1 arg2
And another running GUI instance would perform an appropriate action.
What is the easiest way of implementing something like this?
You could have the GUI application listen on a TCP port (on the
localhostinterface) and the CLI application would connect to it.One way to do this would be to use REST over HTTP.