There is a pretty comprehensive article describing this method and
source code available at
or equivalently at
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:
Note that the command files are for Windows, the article indicates
that the code should be platform independent (if that is important to
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"
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
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.