Languages and Scripting

UnsatisfiedLinkError loading a library on HP-UX

 
vjkamble
New Member

UnsatisfiedLinkError loading a library on HP-UX

I am a newbie to JNI and have problem loading a .sl library file on HP-UX 11i V2. To test whether the library loads, I am just doing a System.load() with absolute path of the .sl file. I get the following error

"java.lang.UnsatisfiedLinkError: /home/test/bin/hp9000s800/libGetExt.sl: No such file or directory"

The following line of code throws error:
System.load("/home/test/bin/hp9000s800/libGetExt.sl");

I have made sure that the file exists and the user has read permission. I have a windows equivalent .dll and it has problems loading.
Please note that I did not build the library but have to invoke a method in the library. Could there be other libraries that need to be "pre"loaded. I am afraid I do not know how to find that out.

Any help will be much appreciated. TIA.
3 REPLIES 3
Matti_Kurkela
Honored Contributor

Re: UnsatisfiedLinkError loading a library on HP-UX

The "No such file or directory" error when loading a library might also mean that the library depends on some other libraries, and those cannot be found.

Run "ldd -s /home/test/bin/hp9000s800/libGetExt.sl" to see which libraries (if any) might be required and where the system is trying to find them.

Other options of the ldd command might also be helpful: see "man ldd" for more information.

The documentation of that library should say something about any required dependencies: if the dependencies are not documented, you might want to treat it as a "documentation bug" and file an appropriate bug report to the author of that library.

MK
MK
Dennis Handly
Acclaimed Contributor

Re: UnsatisfiedLinkError loading a library on HP-UX

>the user has read permission.

Execute permission is also needed.

>Could there be other libraries that need to be preloaded.

If so, it is a bad design. As MK mentions, using dependent shlibs is better.

Madhu.Ramaraj
New Member

Re: UnsatisfiedLinkError loading a library on HP-UX

Even if you are using absolute path, I think you still need to set the system property java.library.path.

Please try the following. (C:\tmp is just a sample folder)
While running the Java program, set the system property, using the following:

java -Djava.library.path=c:\tmp