how can C program calls Java? Thanks

S

Shuo Yang

Hi folks,
How can a C program call a Java program? Is there any reference on
that point? I need some help on this issue, thanks.
 
J

John Davison

Shuo said:
Hi folks,
How can a C program call a Java program? Is there any reference on
that point? I need some help on this issue, thanks.

If you're asking how to start a Java program from a C program, then you
should ask comp.lang.c - they might give you trouble since that problem
is really OS dependant. It's just a matter of running the java.exe (or
java) program with the correct arguments.

If you asking how to run C code from inside a Java program, Google for JNI.

- john
 
T

Tony Morris

JNI can achieve both calls to C from Java and vice-versa as per OP
requirements.
 
D

David Hilsee

John Davison said:
If you're asking how to start a Java program from a C program, then you
should ask comp.lang.c - they might give you trouble since that problem
is really OS dependant. It's just a matter of running the java.exe (or
java) program with the correct arguments.
<snip>

JNI might be a better option here, depending on what you're doing. It's
generally more powerful (and possibly more efficient) than launching
java.exe as a separate process.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,430
Messages
2,571,676
Members
48,796
Latest member
Greg L.

Latest Threads

Top