I'm trying to recreate this tutorial on Windows: Java Native Interface (JNI)
When I try to compile it I get the following error:
fatal error: jni.h: No such file or directory
#include <jni.h>
compilation terminated.
My command line is:
gcc -Wl,--add-stdcall-alias -IC:\Program_Files\Java\jdk1.7.0_45\include -IC:\Program_Files\Java\jdk1.7.0_45\include\win32 -shared -o hello.dll HelloJNI.c
I compile in the folder where all the files are.
I am sure that the file "jni.h" in this folder is located:
C:\Program Files\Java\jdk1.7.0_45\include
Does anyone know why the import statement does not work?
Thanks!
Underscore is not the same as space. If jni.h
really is in the "program files" directory you should use this command:
gcc -Wl,--add-stdcall-alias -I "C:\Program Files\Java\jdk1.7.0_45\include" -I "C:\Program Files\Java\jdk1.7.0_45\include\win32" -shared -o hello.dll HelloJNI.c
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With