title: Android NDK - Library not found CANNOT LINK EXECUTABLE - how to set LD_LIBRARY_PATH?
body: <p>I have an Android activity where I'm executing NDK compiled code (command line program) with:</p>
  
  <pre><code>Runtime.getRuntime().exec(myCommand);
  </code></pre>
  
  <p>and load the needed shared libraries with:</p>
  
  <pre><code>static {
      System.loadLibrary(myLib);
  }
  </code></pre>
  
  <p>but when running my project and printing the output from error stream I get the following error:</p>
  
  <pre><code>link_image[1963]:  7520 could not load needed library 'libmyLib.so' for './myCommand'
  (load_library[1105]: Library 'libmyLib.so' not found)CANNOT LINK EXECUTABLE
  </code></pre>
  
  <p>I assure <code>libmyLib.so</code> does exist in my project under <code>libs/armeabi/</code> directory and it's copied to my Android device under <code>/data/data/myProject.path.package/lib/</code> directory. Owner and group of both executable and library are <code>system:system</code> and permissions are ok as well.</p>
  
  <p>When executing the command from adb shell in the beginning I get the same error but then I can set <code>LD_LIBRARY_PATH</code> and it runs ok:</p>
  
  <pre><code>./adb shell
  export LD_LIBRARY_PATH=/data/data/myProject.path.package/lib:$LD_LIBRARY_PATH
  /data/data/myProject.path.package/myCommand
  </code></pre>
  
  <p>So the question is, how to do that from java Android project?</p>
  
  <p>Note: I'm using Linux, Eclipse + Sequoyah, NDK-r5b, Android 2.3.6 (API 10) on GT-P1010.</p>