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
Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
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
JavaPF (September 5th, 2011)