Win a copy of Create an Uber Clone in 7 Days: Build a real world full stack mobile app in Java this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

location of jni.h and jni_md.h?  RSS feed

 
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am making my first attempt at JNI. I've written my native method implementations and I am trying to create the shared library (in my case a dll since I am developing for Windows 2000). I get an error because the compiler can not find jni.h and jni_md.h. I fixed the error by copying these two header files into the directory where my native method implementation .cpp file is located and changing the #include from using angle brackets to "".
I know that this was not the correct thing to do. Where should jni.h and jni_md.h be located? Is it normal to have to copy these files there? Or should I be changing an environment variable that MSVC++ 6.0 uses in order to locate system header files?
Thanks for your help.
 
author and iconoclast
Sheriff
Posts: 24220
40
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you should leave the headers where they belong, but add settings to your project to tell the compiler where to find them. The command-line settings should look like (I believe)
/I C:\j2sdk1.4.2\include /I C:\j2sdk1.4.2\include\win32
It's been a few years since I've seen VC++, so I can't tell you exactly where to put this, but it's going to be part of the project settings.
 
Ranch Hand
Posts: 776
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In fact exactly where you specify this will be different for VS6 and VS.NET.
But Project->Properties is where to start.
Guy
 
Robin Clark
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, you are exactly right. It has been too long since I used MSVC++ 6.0. You can either specify where to find includes via the command line or via Project->Settings. Thank you very very much!
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In Microsoft Visual C++ 6.0, you have to put the command line instructions into the bottom box (titled "Project Options") of the "C/C++" tab. Just figured I'd let people know, since it took me a little trial and error to figure out where to put the command!
 
Have you no shame? Have you no decency? Have you no tiny ad?
Why should you try IntelliJ IDEA ?
https://coderanch.com/wiki/696337/IntelliJ-IDEA
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!