• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

jni.h

 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
Where should I put the jni.h file for creating dynamically loadable library (DLL)on Win32 system? I tried to put it at C:\jdk1.3\bin and C:\jkd1.3\include but still got the error message-: fatal error C1083: Cannot open include file: 'jni.h': No such file or directory.
[This message has been edited by tom nugent (edited January 08, 2001).]
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Tom,
I am assuming here that you are using some sort of IDE (C++/C) to write the JNI code. I am further assuming that you have a C++/C project to generate the DLL.
The IDE you are using should have a menu labeled Project. In the menu there should be a menu option called Property or Options. This will allow you to set the various properties for the project. Please find a tab pane labeled Directories/Conditionals (or something similar) which will allow you to specifiy the include files/directories, library files/directories. In the box for include files you will have to specify the directory where the jni.h file is. It does not matter which directory, as long as you specify the correct directory name here.
I don't know whether its required for JDK 1.3 or not, but in JDK 1.2.2 there is another directory root\JDK1.2.2\inlcude\win32 that also needs to be included in the C++/C project.
I hope this answers your question.
 
tom nugent
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am not too familiar with Visual C++ and its IDE. I just followed the direction for creating shared libraries for Win32 on
http://java.sun.com/docs/books/tutorial/native1.1/stepbystep/step5.html
from command line, I typed as directed:
cl -Ic:\java\include -Ic:\java\include\win32
-LD HelloWorldImp.c -Fehello.dll
where, as you can see from the link, file HelloWorldImp.c contains the line "include jni.h". I got the error like previously stated. I guess I need to know how to "specify the include path that corresponds to the setup on your own machine. ", like indicated on the link. Please help.
 
Ranch Hand
Posts: 347
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Tom!
I think you had it right when you put the jni.h file in c:\jdk1.3\include directory. That's where mine is and it works fine.
You probably need to modify what you entered on the command line. The link says to use:


cl -Ic:\java\include -Ic:\java\include\win32
-LD HelloWorldImp.c -Fehello.dll


You'll need to substitute
-Ic:\jdk1.3\include
for
-Ic:\java\include
and so forth to match the paths on your machine.
Hope this helps.
Stephanie
 
tom nugent
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you Stephanie. It worked!
 
tom nugent
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Stephanie,
By any chance, have you tried to declare 'jclass' type in the SomeFile.c file? I got the error " error C2275: 'jclass' : illegal use of this type as an expression... c:\jdk1.3\include\jni.h(87) : see declaration of 'jclass' ". I checked and the jni.h file is indeed in c:\jdk1.3\include\ . I appreciate your help. Thank you.
--Tom
 
reply
    Bookmark Topic Watch Topic
  • New Topic