Skip to Main Content

Java HotSpot Virtual Machine

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

jni.h file not found when creating dll

843829Nov 29 2006 — edited Nov 30 2006
I'm just learning how to use the JNI and have been following the tutorial provided by Sun. My knowledge of C and its compilation system is very limited (I'm a Java generation programmer) I try to create a dll using the method proposed by the tutorial like this:
cl -Ic:program files\java\jdk1.5.0_09\ include 
-Ic:program files\java\jdk1.5.0_09\include\win32 
-LD HelloWorldImp.c 
-Fehello.dll
I get an error message stating
fatal error C1083: Cannot open include file: 'jni.h': No such file or directory
The code is identical to the tutorial's code.
I am running Windows XP and Microsoft Visual C++ 6.0

The preprocessor statement where the error is located is
#include <jni.h>
and this is the very first line in the c program named HelloWorldImp.c

I fixed this problem by just placing a copy of jni.h into the same directory, but a slew of other problems followed, and I don't think that that is a very good practice to get into anyway.

I have set the paths of the directories of the include and include/win32 in my environment variables, because I don't know what else to do and I believe in luck. This also proved to be a miserable disgrace. How can I get the c file to compile into a dll? I know that this seems to be more of a c problem than a java problem, but I've compiled my share of c programs without difficulty. And I know that this seems like a pretty elementary problem, but my mother loves me anyway.

Thanks for any help on the issue :)

-Daniel
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 28 2006
Added on Nov 29 2006
1 comment
722 views