문제

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?

도움이 되었습니까?

해결책

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

다른 팁

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 .

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top