nbarraille nbarraille -4 years ago 95
C Question

How to use a C API in Java? JNI?

I'm building a J2EE project, in which I would like to use an API which is only available in C.
I was thinking of using JNI to do so, but after a quick look at this tutorial, it looks that I in order to use JNI, I need to have the source code (.c files) to compile some kind of "JNI library".

In my case, the API only comports the .h with the signature of all the methods, and the already compiled .dll (or .so).

How could I do this?

Thank you!

Answer Source

JNA is a JNI-based library that allows calling normal C functions without needing a JNI-specific wrapper for each one.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download