UnsatisfiedLInkError Eclipse JNI (works from command line but not in Eclipse) package names
<p>I'm able to run a program from the commmand line by typing "java main"   where main.java and main.class are in the same directory as well as any related classes.  This runs fine.  When I try to run the same program in Eclipse I get Unsatisfied link errors.  I think this is related to the JVM being used. I think that the command line java call is using a different JVM then eclipse.  How can you specify which JVM java uses on the command line?</p>

<p>I'm getting an UnsatisfiedLinkError when I run a program in Eclipse that uses native libraries.</p>

<p>This isn't a typical "cannot find...." link error I believe it has actually found the file but there is some other problem.</p>

<blockquote>
  <p>Exception in thread "main" java.lang.UnsatisfiedLinkError: com.me.this.MyClass.MyMethod(Ljava/lang/String;)I</p>
</blockquote>

<p>You can see that if it just could not find the shared library it would say something like:</p>

<blockquote>
  <p>Exception in thread "main" java.lang.UnsatisfiedLinkError: no MySharedFile.so in java.library.path</p>
</blockquote>

<p>So I believe it is finding the file. </p>

<p>Some other issues that are relavent are the fact that if i run the program from the command line instead of in eclipse it finds the .so and runs the program perfectly.  <strong>Also I had this program running before in a different Eclipse that was using an older 1.6 JVM. I've tried to use that in this eclipse but it hasn't helped.</strong> </p>

<p>Is this a problem finding the .so shared file? Or something completely different like I'm using the wrong JVM.  I used strace on the java command line program and it appears it's using the new 1.7jdk the same one I'm using now in Eclipse and it will not work. </p>

<p>The .so is in /usr/lib64 and I've also created a -Djava.library.path=... entry in the vm arguments for the run configuration just in case. </p>

<p>I added these try catch around the load:</p>

<pre><code>static
    {
        try{
            System.loadLibrary("MyAwesomeLibrary");
            System.out.println("MyAwesomeLibrary library loaded \n");
        }
        catch(UnsatisfiedLinkError e){
            System.out.println("Did not load library");
            e.printStackTrace();
        }

    }
</code></pre>

<p>And I get: </p>

<pre><code>MyAwesomeLibrary library loaded 

Exception in thread "main" java.lang.UnsatisfiedLinkError: com.me.this.MyClass.MyMethod(Ljava/lang/String;)I
    at com.me.this.MyClass.MyMethod(Native Method)
    at com.me.this.Main.main(Main.java:8)
</code></pre>

<p>It's being called froma main class that looks like this:</p>

<pre><code>public class Main
{
        public static void main( String[] args )
        {
                ClassThatContainsLoadedLIbrary x = new ClassThatContainsLoadedLibrary();
                int y = x.Ping( "thisaddress" );
</code></pre>

<p>So it appears that it's loading...at least it's getting to the print statement without link errors.  the UnsatisfiedLink errors when it actually triest to <strong><em>use</em></strong> the library. </p>

<p>I've been working on this problem for weeks so would really appreciate it if some one had some insight into this. Thanks. </p>
