Question

I am implementing the simple JNI example , as given in

http://java.sun.com/docs/books/jni/html/start.html

At the second last step, when the C source is being compiled,

the following command is used---

C:\Program Files\Java\jdk1.6.0_21> cl -IC:\Program Files\Java\jdk1.6.0_21\include -IC:\Program Files\Java\jdl1.6.0_21\include\win32 -MD -LD Callbacks.c -FeCallbacks.dll

I get the following error---

"Cannot open include file "jni.h", No such file or directory exists."

But jni.h does exist in java/jdk1.6.0_21/include folder.

How can I remove this error?

Was it helpful?

Solution

Since the path contain spaces u need to enclose the path inside "" like cl -IC:\Program Files\Java\jdk1.6.0_21\includ e -I"C:\Program Files\Java\jdl1.6.0_21\include\win32" -MD -LD Callbacks.c -FeCallb acks.dll

OTHER TIPS

If the path contains spaces then you must have to quote the path . In my case the command is as follows :

cl -I"C:\Program Files\Java\jdk1.8.0_91\include" -I"C:\Program Files\Java\jdk1.8.0_91\include\win32" -LD HelloWorldImp.c -Fehello.dll

Hope it helps .

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top