title: library not found in java.library.path
body: <p>I'm a newbie to JNI, so I was trying this introduction to JNI tutorial earlier that just calls native to print Hello World! Everything went fine until the point that I wanted to run the java file, at which I keep getting the error: Exception in thread "main": java.lang.UnsatisfiedLinkError: no hello library found in java.library.path. I have googled the error and looked at a lot of peoples' suggestions, but none worked for me unfortunately! I have tried the following:</p>
  
  <ul>
  <li>Running with command: java -Djava.library.path = "<em>Path to library</em>" HelloWorld</li>
  <li>setting the LD_LIBRARY_PATH to my .so path</li>
  </ul>
  
  <p>Everyone else had their issues resolved after doing one of the two above, but not me!</p>
  
  <p>Here is the Java Code:</p>
  
  <pre><code>public class HelloWorld {
  
      static {
          System.loadLibrary("hello");
      }
  
      private native void printHelloWorld();
  
      public static void main(String[] args) {
          new HelloWorld().printHelloWorld();
      }
  } 
  </code></pre>
  
  <p>And code for native is as follows:</p>
  
  <pre><code>void JNICALL Java_printHelloWorld(JNIEnv *env, jobject obj) {
      printf("HelloWorld!");
  }
  </code></pre>
  
  <p>EDIT: I even tried copying the library to the actually directory of java.library.path, but it's still giving me the same error!</p>