本文介绍了java lang UnsatisfiedLinkError的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
专家,
我正在Ubuntu 10.04中开发一个Java应用程序.
我正在尝试加载名为"libTestJavaLib.so"的库,但出现以下错误
hi experts,
I am developing one java application in ubuntu 10.04.
I am trying to load library named "libTestJavaLib.so" but below error given
Exception in thread "main" java.lang.UnsatisfiedLinkError: no libTestJavaLib in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1860)
at java.lang.Runtime.loadLibrary0(Runtime.java:845)
at java.lang.System.loadLibrary(System.java:1084)
at javaapptest.JavaAppTest.<clinit>(JavaAppTest.java:14)
我已经尝试了以下所有"libTestJavaLib"文件的路径
/FileSystem/lib
/usr/lib
/uer/lib/jvm/jdk1.7.0/lib
/uer/lib/jvm/jdk1.7.0/lib/i386
但这仍然是错误.
我该怎么解决?
我的示例代码如下
i have try all below path for "libTestJavaLib" file
/FileSystem/lib
/usr/lib
/uer/lib/jvm/jdk1.7.0/lib
/uer/lib/jvm/jdk1.7.0/lib/i386
but it is still error.
how can i solved it?
My sample Code is as under
public class JavaAppTest {
static
{
System.loadLibrary("libTestJavaLib");
}
static long device;
public static void main(String[] args) {
System.out.println("testing");
device = mfs100.MFS100_Init();
System.out.println("testing complete");
}
}
mfs100.java
mfs100.java
public class mfs100 {
public static long MFS100_Init() {
long cPtr = mfs100javaJNI.MFS100_Init();
return cPtr;
}
public static int MFS100_Close(long device) {
return mfs100javaJNI.MFS100_Close(device);
}
}
mfs100javaJni.java
mfs100javaJni.java
public class mfs100javaJNI {
public final static native long MFS100_Init();
public final static native int MFS100_Close(long jarg1);
}
推荐答案
这篇关于java lang UnsatisfiedLinkError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!