Hi,
Is it possible to call a C function from Java. I need to develop Java interface which calls C functions in a daemon. The problem is that the Java and C are in different daemons. Is there a way to combine the two languages?
Regards
Peter
Printable View
Hi,
Is it possible to call a C function from Java. I need to develop Java interface which calls C functions in a daemon. The problem is that the Java and C are in different daemons. Is there a way to combine the two languages?
Regards
Peter
There are 2 main ways to call external functions from Java: The Java Native Interface (JNI), or Java Native Access (JNA). Personally I've never worked with JNA before, but I have worked with JNI before.
For a quick starter tutorial on JNI, see An Introduction to the Java Native Interface.
Thank you for the answer! One thing I don't understand - is it doing to work if the Java code and the C code are in two different Linux daemons? Or thy must be in one folder compiled together?
Here is the best and simple tutorial for you
Java native interface step by step solution
You will also find how to configure visual studio for jni project