Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7192489
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T19:57:04+00:00 2026-05-28T19:57:04+00:00

I’m able to run a program from the commmand line by typing java main

  • 0

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?

I’m getting an UnsatisfiedLinkError when I run a program in Eclipse that uses native libraries.

This isn’t a typical “cannot find….” link error I believe it has actually found the file but there is some other problem.

Exception in thread “main” java.lang.UnsatisfiedLinkError: com.me.this.MyClass.MyMethod(Ljava/lang/String;)I

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

Exception in thread “main” java.lang.UnsatisfiedLinkError: no MySharedFile.so in java.library.path

So I believe it is finding the file.

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. 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.

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.

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.

I added these try catch around the load:

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

    }

And I get:

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)

It’s being called froma main class that looks like this:

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

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 use the library.

I’ve been working on this problem for weeks so would really appreciate it if some one had some insight into this. Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T19:57:06+00:00Added an answer on May 28, 2026 at 7:57 pm

    Look at this: http://docs.oracle.com/javase/7/docs/api/java/lang/UnsatisfiedLinkError.html.

    Thrown if the Java Virtual Machine cannot find an appropriate native-language definition of a method declared native.

    The problem is not with the JVM per se, but with the JVM being unable to find your native libraries. You need to specify the path where the native libraries are stored. This can be done by adding the following as an argument to your JVM in eclipse:

    -Djava.library.path=...
    

    Here, take a look at this: http://mindprod.com/jgloss/runerrormessages.html#UNSATISFIEDLINKERROR

  2. If you get the error after the class containing the native method is safely loaded, when you invoke a native method, make sure you generated your *.h file with the fully qualified javah.exe -jni -o mouse.h com.mindprod.mouse.Mouse and not simply javah Mouse
  3. If you get the error after the class containing the native method is safely loaded, when you invoke a native method, check that the *.cpp method signatures exactly match those in the *.h file. You should see method names like this: Java_com_mindprod_mouse_Mouse_GetMousePosition that start with the word Java and contain the package, class and method name all strung together. Make sure you remembered to implement all the methods.
  4. You need to regenerate the *.h and recompile the *.c file if you change the package name.
  5. You should probably go through this list to make sure you’re doing all the things correctly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I am currently running into a problem where an element is coming back from
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a text area in my form which accepts all possible characters from
Does anyone know how can I replace this 2 symbol below from the string
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have thousands of HTML files to process using Groovy/Java and I need to
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a bunch of posts stored in text files formatted in yaml/textile (from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.