简体   繁体   中英

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

I am working on lemur tool and i am running with some problem.

when i execute the code , java complains

Exception in thread "main" java.lang.UnsatisfiedLinkError: no indri_jni in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1886)
at java.lang.Runtime.loadLibrary0(Runtime.java:849)
at java.lang.System.loadLibrary(System.java:1088)
at lemurproject.indri.indriJNI.<clinit>(indriJNI.java:109)
at lemurproject.indri.IndexEnvironment.<init>(IndexEnvironment.java:39)
at indritest.main(indritest.java:9)

this is My code

    import lemurproject.indri.*;
public class indritest
{
    public static void main ( String[] args ) 
    {
        try {

            String [] stopwords = {"a", "an", "the", "of"};
            IndexEnvironment env = new IndexEnvironment();
            env.setStoreDocs(true);
            env.setStopwords(stopwords);
            env.create("aaa"); 
            env.addFile("trekfile.txt", "booomer.txt");
            env.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

I am using jdk 1.8.0_11 x64bit , windows 7 ultimate x64bit , indri5.7 x64bit , eclipse juno x64bit.

..................................................................................................................................................................... EDIT:-

I worked with the solution given by RALF WAGNER now my console is showing this Bug. after printed the System.getProperty("java.library.path") in my console i am getting this output. indri_jni.dll is already present in system32 folder.

My code.

 import lemurproject.indri.*;
public class indritest
{
    public static void main ( String[] args ) 
    {
        try {
            System.out.println(System.getProperty("java.library.path"));
            //System.loadLibrary("indri_jni");
            String [] stopwords = {"a", "an", "the", "of"};
            IndexEnvironment env = new IndexEnvironment();
            env.setStoreDocs(true);
            env.setStopwords(stopwords);
            env.create("aaa"); 
            env.addFile("trekfile.txt", "booomer.txt");
            env.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

My console outout.

  C:\Program Files\Java\jdk1.8.0_11\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\DMIX;C:\Program Files\Indri\Indri 5.7\bin;C:\Program Files\Java\jdk1.8.0_11\bin;.
Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\Program Files\Indri\Indri 5.7\bin\indri_jni.dll: Can't find dependent libraries
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1929)
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1847)
    at java.lang.Runtime.loadLibrary0(Runtime.java:870)
    at java.lang.System.loadLibrary(System.java:1119)
    at lemurproject.indri.indriJNI.<clinit>(indriJNI.java:109)
    at lemurproject.indri.IndexEnvironment.<init>(IndexEnvironment.java:39)
    at indritest.main(indritest.java:10)

In addition to the Java classes from the project you're using a native library ie a library that is not written in Java. You need to add the native library to your class path and may need to load the library before using any classes like IndexEnvironment by calling

System.loadLibrary("<NAME OF THE LIBRARY>");

From the stack trace I'd guess that the library is called "indri_jni", so I think on Windows you should add "indri_jni.dll" to your Windows path. This usually includes the working directory of the application so you may have to put the library there or add the directory where the library is found to your path environment variable.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM