title: JNI issue on Linux: cannot open shared object file
body: <p>I've seen this question on here, tried the proposed fixes, but no success so far for me. I have quite some Java experience, but JNI is a long time ago, never did it on Linux though...</p>
  
  <p>I'm trying to get a simple HelloWorld JNI app running on Linux.</p>
  
  <p>Small java file:</p>
  
  <pre class="lang-java prettyprint-override"><code>class HelloWorld {
  
      private native void print();
  
      public static void main(String[] args){
          new HelloWorld().print();
      }
  
      static {
          System.out.println(System.getProperty("java.library.path"));
          System.loadLibrary("HelloWorld");
      }
  
  }
  </code></pre>
  
  <p>Small C file:</p>
  
  <pre class="lang-c prettyprint-override"><code>#include &lt;jni.h&gt;
  #include &lt;stdio.h&gt;
  #include "HelloWorld.h"
  
  JNIEXPORT void JNICALL
  Java_HelloWorld_print(JNIEnv *env, jobject obj)
  {
      printf("Hello World!\n");
      return;
  }
  </code></pre>
  
  <p>compiled the C file by:</p>
  
  <pre><code>gcc -shared -Wall -fPIC HelloWorld.c -I/usr/lib/gcc/x86_64-redhat-linux/3.4.3/include/ -o libHelloWorld.so
  </code></pre>
  
  <p>Run the app by:</p>
  
  <pre><code>java HelloWorld
  </code></pre>
  
  <p>or</p>
  
  <pre><code>java -Djava.library.path=/home/nxp40954/jnitesting/. HelloWorld
  </code></pre>
  
  <p>But no good, getting a:</p>
  
  <pre><code>Exception in thread "main" java.lang.UnsatisfiedLinkError: /home/nxp40954/jnitesting/libHelloWorld.so: /home/nxp40954/jnitesting/libHelloWorld.so: cannot open shared object file: No such file or directory
  </code></pre>
  
  <p>Strange, because there is actually a <code>/home/nxp40954/jnitesting/libHelloWorld.so</code> file. </p>
  
  <p>Does anyone have a clue?</p>