0

I have an application which uses one native library "libSample.so" which is depend upon another .so file.I am trying to load that library using following code

File File1 = new File("libSample.so");

static
{
     try {
            System.load(File1.getAbsolutePath());

          } catch (UnsatisfiedLinkError e) {
            System.out.println("Link Error");
          }

 }

Before loading library I have tried setting up LD_LIBRARY_PATH where the library is located using command line.

export LD_LIBRARY_PATH=/home/usb:${LD_LIBRARY_PATH}

But still the library not get load. What should I do now? Please help.

rachana
  • 3,344
  • 7
  • 30
  • 49

1 Answers1

1
static {
    System.loadLibrary("libSample.so");
}

I assumed that you have your jars in /libs directory and .so file in /libs/armeabi directory so the system finds them. You do not have to add .so files in your eclipse build path.

Sajal Dutta
  • 18,272
  • 11
  • 52
  • 74
  • Thanks for your response.But I have already tried with the System.loadLibrary("libSample.so");but still there is problem in loading library – rachana Jul 29 '13 at 10:56
  • Hey I am a novice here. And getting the same problem doing it with OpenCV third party code. Please help with some intuitions – Milind Jindal Oct 08 '13 at 08:27
  • @MilindJindal If your problem is not solved by this answer, then most probably you have different problem. If you can't find any answer here in SO, please post a question explaining your scenario. – Sajal Dutta Oct 08 '13 at 11:47