When building jni
code, you have to ensure that the header file generated using javah
matches the native
declarations from the .class
file.
When you change the native method signature, you have to:
- Recompile the
.java
file - Regenerate the
.h
file from the resulting.class
file - Make sure that the signature of the definition in the
.c
file matches the declaration in the.h
file
If you miss any of the steps, you can end up being unable to recompile the .c
file, or end up with a non-functional native library that won't load in the VM.