这几天在linux下弄jni 出了这个错误!查了好多页面才找到答案,现在将原帖位置引用到下面希望能够对和我遇到相同问题的人有所帮助,原帖来自sun网站 http://forums.sun.com/thread.jspa?messageID=4090176 其中涉及的测试源码如下: For those who didn't install java with default settings, a systematic way for solving JNI class path problem is: 如果你上面看不懂的话就继续向下面看: 查了其他的资料: 另外也可以通过如下方法处理该问题 I'm new to JNI. I see there are several ways to set JVM to look for libraries dll, so, etc. System.setProperty("java.library.path", "."); System.loadLibrary("hello"); That's when UnsatisfiedLinkError java.lang.UnsatisfiedLinkError: no hello in java.library.path at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1682) at java.lang.Runtime.loadLibrary0(Runtime.java:822) at java.lang.System.loadLibrary(System.java:992) at HelloWorld.main(HelloWorld.java:17) But if I comment the line that sets the java.library.path and call the program with the command java -Djava.library.path=. HelloWorld works. The question is: Why is not working? How should it be the property setup? I rather don't set Variables, or use -D option. |
联系客服