title: UnsatisfiedLinkError with JNI
body: <p>.h file   </p>
  
  <pre><code>#include &lt;jni.h&gt;
  #include "NativePackage_HelloWorld.h"
  #include &lt;stdio.h&gt;
  
  JNIEXPORT void JNICALL Java_NativePackage_HelloWorld_displayHelloWorld(JNIEnv *env, jobject obj)   {
  printf("Hello world!\n");
  return;
  }
  </code></pre>
  
  <p>Java</p>
  
  <pre><code>package NativePackage;
  
  public class HelloWorld {
  public native void displayHelloWorld();
  
  static {
      System.loadLibrary("hello");
  }
  
  public static void main(String[] args) {
      new HelloWorld().displayHelloWorld();
  }
  }
  </code></pre>
  
  <p>.c file</p>
  
  <pre><code>#include &lt;jni.h&gt;
  #include "NativePackage_HelloWorld.h" 
  #include &lt;stdio.h&gt;
  
  JNIEXPORT void JNICALL Java_NativePackage_HelloWorld_displayHelloWorld(JNIEnv *env, jobject obj){
  printf("Hello world!\n");
  return;
  }
  </code></pre>
  
  <p>I've compiled my .c file using </p>
  
  <pre><code>gcc -I /Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/Contents/Home/include/ -I  /Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/Contents/Home/include/darwin/ -fPIC -o hello -c   HelloWorldImp.c 
  </code></pre>
  
  <p>However, trying to run using <code>java NativePackage/HelloWorld</code> produce the following error:</p>
  
  <pre><code>java  -Djava.library.path=NativePackage/ NativePackage/HelloWorld
  
  Exception in thread "main" java.lang.UnsatisfiedLinkError: no hello in java.library.path
  at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1857)
  at java.lang.Runtime.loadLibrary0(Runtime.java:870)
  at java.lang.System.loadLibrary(System.java:1119)
  at NativePackage.HelloWorld.&lt;clinit&gt;(HelloWorld.java:7)
  </code></pre>
  
  <p>I'm running on a MAC OS X 10.10</p>