When jni dll is generated, the system prompts that jni. h Cannot be found, and the Cannot open include file: \ 'jni. h \ ': No such file or directory error occurs.
This error occurs when you run the Visual Studio 2008 project.
# Include <stdio. h>
# Include <jni. h>
Int main ()
{
Printf ("Hello World ");
}
But when I try to build, I get the following error-
1> c: testtest. cpp (2): fatal error C1083: Cannot open include file: 'jni. H': No such file or directory
Solution.
To copy the following files to the include folder under the jdk installation directory
The Code is as follows: |
Copy code |
Jdkincludejni. h Jdkincludewin32jawt_md.h Jdkincludewin32jni_md.h |
The above three files under the jdk installation directory are copied to the include folder under the vc directory. For example, my installation location is:
The Code is as follows: |
Copy code |
D: Program FilesMicrosoft Visual StudioVC98Include |
You can determine the installation location.