不行呀,我的代码如下: public class test { public native void IsMemoHasp(); static{ System.load("hello"); }
/** Creates a new instance of test */ public test() { }
/** * @param args the command line arguments */ public static void main(String[] args) { new test().IsMemoHasp(); }
}可是不行,一运行就出下面的错: java.lang.UnsatisfiedLinkError: Expecting an absolute path of the library: hello at java.lang.Runtime.load0(Runtime.java:695) at java.lang.System.load(System.java:797) at test.<clinit>(test.java:14) Exception in thread "main" 我已经确定HOLLE。DLL文件和这个类文件在一起了,急!!!!
后来我设置了classpath环境变量后,再运行错误就变成: Exception in thread "main" java.lang.UnstaisfiedLinkError: IsMemoHasp at test.display<Native Method> at test.main<test.java:26> 我要如何做?
package untitled2;public class callhasp { public native int IsMemoHasp(long l0, long l1, String str); static{ System.load("hello"); }
/** Creates a new instance of test */ public callhasp () { }
/** * @param args the command line arguments */ public static void main(String[] args) { new callhasp ().IsMemoHasp(1l,1l, ""); }
}
请问 new callhasp ().IsMemoHasp(1l,1l, "");中的(1l,1l, "")是从何而来呀??ll与ll是什么意思呀?
我照楼上大哥说的改了,可是还是不行呀!!!!! 错误还是: Exception in thread "main" java.lang.UnstaisfiedLinkError: IsMemoHasp at test.display<Native Method> at test.main<test.java:26>
static{
System.loadLibrary(dllName);
}
public class test {
public native void IsMemoHasp();
static{
System.load("hello");
}
/** Creates a new instance of test */
public test() {
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
new test().IsMemoHasp();
}
}可是不行,一运行就出下面的错:
java.lang.UnsatisfiedLinkError: Expecting an absolute path of the library: hello
at java.lang.Runtime.load0(Runtime.java:695)
at java.lang.System.load(System.java:797)
at test.<clinit>(test.java:14)
Exception in thread "main" 我已经确定HOLLE。DLL文件和这个类文件在一起了,急!!!!
Exception in thread "main" java.lang.UnstaisfiedLinkError: IsMemoHasp
at test.display<Native Method>
at test.main<test.java:26> 我要如何做?
package untitled2;public class callhasp {
public native int IsMemoHasp(long l0, long l1, String str);
static{
System.load("hello");
}
/** Creates a new instance of test */
public callhasp () {
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
new callhasp ().IsMemoHasp(1l,1l, "");
}
}
new callhasp ().IsMemoHasp(1l,1l, "");中的(1l,1l, "")是从何而来呀??ll与ll是什么意思呀?
错误还是:
Exception in thread "main" java.lang.UnstaisfiedLinkError: IsMemoHasp
at test.display<Native Method>
at test.main<test.java:26>
改成
System.loadLibrary("hello");