Hello Lk_sf,
There is a pretty comprehensive article describing this method and
source code available at
http://webservices.sys-con.com/read/45840.htm
or equivalently at
http://java.sys-con.com/read/45840.html
which is an article titled "Calling Java from C" [published in two
magazines?]. The direct link to the source code (a zip file), batch
files to build / run the applications under Windows 2000, and sample
files to run is:
http://res.sys-con.com/story/45840/Havey0908.zip
Note that the command files are for Windows, the article indicates
that the code should be platform independent (if that is important to
you).
In the middle of the article is a good introduction into the issues
related to getting data back to your C program. This example uses a
string, but other methods (such as using JNI to call back the C code)
could be used as well.
There are several other good references - try searching with phrases such as
calling "java from c"
or
calling java from c
The first is more specific, the second will also bring up references
of Java calling C. In addition, a phrase like
java jni
or
calling jni
brings up general information related to the Java Native Interface.
Please make a clarification request if the answer is incomplete or unclear.
Good luck with your work.
--Maniac |