title: java.lang.UnsatisfiedLinkError with JNI and c
body: <p>I have seen many examples for a JNI application. I have tried one myself and getting an exception</p>
  
  <pre><code>dileepvikram@dileepvikram-System-Product-Name:~/include$ java -Djava.Library.path=. Test
  Exception in thread "main" java.lang.UnsatisfiedLinkError: no Test in java.library.path
  at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1738)
  at java.lang.Runtime.loadLibrary0(Runtime.java:823)
  at java.lang.System.loadLibrary(System.java:1028)
  at Test.&lt;clinit&gt;(Test.java:9)
  Could not find the main class: Test.  Program will exit.
  </code></pre>
  
  <p>Test.java</p>
  
  <pre><code> public class Test {
     public native void sayHello(int length) ;
     public static void main (String args[]) {
     String str = "I am a good boy" ;
     Test h = new Test () ;
     h.sayHello (str.length() ) ;
    }
    static {
      System.loadLibrary ( "Test" ) ;
    }
   }
  </code></pre>
  
  <p>I have compiled he code and created a Test.h with the code</p>
  
  <pre><code>javah -jni Test
  </code></pre>
  
  <p>Test.c</p>
  
  <pre><code>#include "Hello.h"
  #include&lt;stdio.h&gt;
  #include "jni.h"
  
  
  JNIEXPORT void JNICALL Java_hello_sayHello
    (JNIEnv *env, jobject object, jint len) {
    printf ( "\nLength is %d", len ); }
  void main()
  {
      printf("\nHello World\n");
  
  }
  </code></pre>
  
  <p>Then I  have compiled the  c code with the command</p>
  
  <pre><code>gcc Test.c -o libTest.so
  </code></pre>
  
  <p>and then tried running the java class  with the command</p>
  
  <pre><code>java -Djava.library.path=. Test
  </code></pre>
  
  <p>And I am getting the exception </p>
  
  <pre><code>dileepvikram@dileepvikram-System-Product-Name:~/include$ java -Djava.Library.path=. Test
  Exception in thread "main" java.lang.UnsatisfiedLinkError: no Test in java.library.path
  at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1738)
  at java.lang.Runtime.loadLibrary0(Runtime.java:823)
  at java.lang.System.loadLibrary(System.java:1028)
  at Test.&lt;clinit&gt;(Test.java:9)
  Could not find the main class: Test.  Program will exit.
  </code></pre>
  
  <p>I have tried a lot ,to find the issue,any help is appreciated.</p>