Index of /~costello/Linux_Invoke
/**
* README.txt
* David Costello, costello@cs.rochester.edu, 4 Jun 2003
* Time-stamp: <2003-06-04 13:08:29 costello>
*
* How to call java via jni under linux example
*/
This is a small example of how to call java from C under Linux.
The gcc compiler does not offer the -R flag which writes the
LD_RUN_PATH into the binary so in this example use
make
make run
I guess in a real program you'll have to muck with LD_LIBRARY_PATH
so the program can find it's dynamic libraries via wrappers or
ENVIRONMENT variables or whatever.
Be advised I have experienced some memory leaking using JNI from
JDK1.3 under solaris. I have not tested extensibly JNI under
Linux or JNI with JDK1.4 or above.
tested using:
gcc version 2.96 20000731 (Red Hat Linux 7.2 2.96-112.7.2)
included example files:
invoke.c -- C program that instantiates a java VM and makes calls
to a java class (Prog.class)
Prog.java -- the simple java program called from C
Makefile -- to build and run the example.