Cannot open include file: 'jni.h': No such file or directory

I'm attempting  to walk through a JNI tutorial found here:

Unfortunately when I use Visual Studio and do the statement #include <jni.h> it can't find the file.

The obvious solution was to include the directories where this file is, which I've done as you can see in the attached project properties jpeg.

However, ever time I try to compile it still can't find the file.

So next I tried adding the two directories under VC++ Directories, (as seen in options.jpeg) and still no luck.

#include <jni.h>
#include <stdio.h>
#include "HelloWorld.h"
 Java_HelloWorld_print(JNIEnv *env, jobject obj)
     printf("Hello World!\n");
// and the H File --------------------------------------------
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for classHelloWorldJNI_HelloWorld */
#ifndef _Included_HelloWorld
#define _Included_HelloWorld
#ifdef __cplusplus
extern "C" {
 * Class:     HelloWorld
 * Method:    print
 * Signature: ()V
JNIEXPORT void JNICALL Java_HelloWorld_print
  (JNIEnv *, jobject);
#ifdef __cplusplus

Open in new window

Who is Participating?
AndyAinscowConnect With a Mentor Freelance programmer / ConsultantCommented:
The second - you have set a path for executables, not for the include (.h) files - combo at top right 'show directories for'.

Give that a try, does it now work OK ?
You can add the jdk folder in  Configuration Properties | C/C++ | General

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.