GUI in Java for a C program.

Hi, I have a console program written in C.

Can I make the GUI for this program in Java ?

The user passes on arguments to the C program through the command line using switches. So instead, the java application will now have input boxes etc to take in user input. It will then call the C program passing all the user input tomain().

The C Program outputs lots of stuff on stdout. So instead, this output will now be displayed in the text area of the GUI.

Does this make sense ? I need to use Java Swing right ?

[547 byte] By [the_learnera] at [2007-11-27 11:19:22]
# 1

> Hi, I have a console program written in C.

>

> Can I make the GUI for this program in Java ?

Yes.

> he C Program outputs lots of stuff on stdout. So

> instead, this output will now be displayed in the

> text area of the GUI.

Look at Runtime.ecex() and Process. That could work.

> Does this make sense ? I need to use Java Swing right

> ?

You can use whatever you want.

CeciNEstPasUnProgrammeura at 2007-7-29 14:36:20 > top of Java-index,Java Essentials,Java Programming...
# 2

Also look at the JNI (Java Native Interface) for allowing interoperability between java and C. I don't know JNI very well (read: "at all"), but there is a forum here on the Sun site that is devoted to nothing but this. You can find it here:

http://forum.java.sun.com/forum.jspa?forumID=52

If you are just calling a c program and letting it run, then CeciNEstPasUnProgrammeur's idea is the way to go. If you are calling c or c++ functions from within a dll, then (I think) JNI is the way to go.

Message was edited by:

petes1234

petes1234a at 2007-7-29 14:36:20 > top of Java-index,Java Essentials,Java Programming...