3 ms·
JNI => "I write C code & after compilation java can access it as com.package.ClassName" JNA => "I write java code & load libsomething at runtime, asking for Fu
by throwawayninja 5y ago
JNI => "I write C code & after compilation java can access it as com.package.ClassName"
JNA => "I write java code & load libsomething at runtime, asking for FuncName(int, int) which java can then call into native code."
You want JNA for your use case.
- geokon 5y agoSo what is the difference between this and JNA? I assume it's not the same since it's taking a while to be added to the language
- pie_flavor 5y agoJNI is the only escape hatch in the JRE. JNA leverages JNI and so has a better API while still keeping the terrible performance. This is like JNA, but more robust, and while also being an escape hatch of its own so that you can finally get performance similar to P/Invoke when making native calls.
- chakkepolja 5y agoThis is apparently focused on efficiently accessing off-heap memory. In Jni lot of things require copies. Only JNI API that's reliably copy-free is ByteBuffer API.