[英]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 当我执行代码时,java抱怨
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. 我正在使用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. 我使用了RALF WAGNER提供的解决方案,现在我的控制台正在显示此Bug。 after printed the System.getProperty("java.library.path") in my console i am getting this output. 在我的控制台中打印System.getProperty(“ java.library.path”)之后,我得到了这个输出。 indri_jni.dll is already present in system32 folder. indri_jni.dll已存在于system32文件夹中。
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. 除了项目中的Java类之外,您还使用本机库,即不是用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 您需要将本机库添加到您的类路径中,并且可能需要在调用诸如IndexEnvironment
类的任何类之前加载该库
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. 从堆栈跟踪中,我猜该库名为“ indri_jni”,因此我认为在Windows上,应将“ indri_jni.dll”添加到Windows路径。 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. 这通常包括应用程序的工作目录,因此您可能必须将库放在此处或将找到库的目录添加到路径环境变量中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.