tags:

views:

115

answers:

1

I have written a command line interface program in the C language. This kind of programs (as you know) waits for user commands typed in the terminal and reacts on depend of them. In fact, the program implements a callback function which parses the command and invokes the appropriate function in order to respond to the user.

Now, I have to make a Java GUI (Graphical user interface) for the desktop (Ubuntu) version of this program and then port the same program to the Android Platform (of course the GUI will respect Android framework), so I'm looking for the best way to do it.

I have heard about JNI and JNA and I don't known which one will be the best for me. By the way what are the main differences between JNI and JNA.

And what about the others IPC techniques and middle-ware (like DBUS).

Any suggestion will be appreciated.

Thanks in advance.

+4  A: 

If your program's functionality is completely available through the command line (and it only works through simple commands rather than a curses-based full-screen interface), then it would probably be easier to just have the GUI interface with the C program through the command line rather than messing with JNI.

Simply use ProcessBuilder to start the program and communicate with it through its stdin and stdout streams.

Michael Borgwardt