title: Cannot find jni.h
body: <p>I am trying to setup a JNI demo example and got stuck at exporting a library on Windows OS.</p>
  
  <p>According to <a href="http://stuf.ro/calling-c-code-from-java-using-jni" rel="nofollow noreferrer">this</a> tutorial, the following command should be executed:</p>
  
  <pre><code>gcc -o libctest.so -shared -I/path/to/jdk/headers ctest.c -lc
  </code></pre>
  
  <p>where the <code>/path/to/jdk/headers</code> refers to the directory that contains <code>jni.h</code>.</p>
  
  <p>This is how invoke the command:</p>
  
  <pre><code>gcc -o ctest.dll -shared -I/"C:/Program Files/Java/jdk1.8.0_45/include" ctest.c -lc
  </code></pre>
  
  <p>and the result was:</p>
  
  <pre class="lang-none prettyprint-override"><code>jni.h: no such file or directory.
  include jni.h
  </code></pre>
  
  <p>I have checked out <a href="https://stackoverflow.com/questions/14529720/how-to-make-jni-h-be-found">this</a> and <a href="https://stackoverflow.com/questions/13466777/jni-h-no-such-file-or-directory">this</a>, which seems to suggest pretty much what I did.</p>
  
  <p>The code:</p>
  
  <pre><code>#include &lt;jni.h&gt;
  #include &lt;stdio.h&gt;
  
  JNIEXPORT void JNICALL Java_HelloWorld_helloFromC
    (JNIEnv * env, jobject jobj)
  {
      printf("Hello from C!\n");
  }
  </code></pre>
  
  <p>How do I get around this error?</p>