Top "Java-native-interface" questions

The Java Native Interface (JNI) gives both the ability for JVM implementations to run system native code and the ability for native code to run Java code (by creating new JVM instances).

What does the registerNatives() method do?

In java, what does the private static method registerNatives() of the Object class do?

java c object methods java-native-interface
How to use NDK? Starting with 'hello world' app

I would like to see a 'Hello world' program written in C/C++ but made to run on Android. I …

c++ android java-native-interface android-ndk
Should you call ReleaseStringUTFChars if GetStringUTFChars returned a copy?

The book "Essential JNI: Java Native Interface" by Rob Gordon contains the following code example to convert a jstring to …

java java-native-interface
Best way to throw exceptions in JNI code?

I'd like a consistent and simple way to throw exceptions in JNI code; something that handles chained exceptions (implicitly from …

java exception-handling java-native-interface
UnsatisfiedLinkError - Unable to load library - Native library not found in resource path

I have the following error at runtime, while trying to run Tess4J: Exception in thread "main" java.lang.UnsatisfiedLinkError: …

java eclipse dll java-native-interface jna
How to access arrays within an object with JNI?

JNI tutorials, for instance this one, cover quite well how to access primitive fields within an object, as well as …

java-native-interface
Passing a byte[] in Java to a function in C through JNI: how to use jarraybyte

This is the first time that I use the JNI and also the first time that I have to write …

java c java-native-interface
JNI - "Cannot open include file: 'jni_md.h'"

This sample program is meant to call a native method written in C. Java Code class HelloWorld { private native void …

java c compiler-errors java-native-interface
Passing data types from Java to C (or vice versa) using JNI

Using JNI can we pass custom data types from Java to C (or vice versa)? I see a mapping of …

java c java-native-interface
jni.h: No such file or directory

I have been following this tutorial, and at step 5, I am getting the following output from GCC: HelloWorld.c:1:17: error: …

java c++ gcc java-native-interface