JNative操作dll文件,找不到dll,路径正确 10
程序代码如下:Filefile=newFile("C:/WINDOWS/system32/gpib-32.dll");if(file.exists()){System.o...
程序代码如下:
File file = new File("C:/WINDOWS/system32/gpib-32.dll") ;
if(file.exists())
{
System.out.println("Exists");
}
else
{
System.out.println("error");
}
JNative v = new JNative("C:/WINDOWS/system32/gpib-32.dll","ibdev") ;
// int i = 0;
// v.setRetVal(Type.INT);
// v.setParameter(i++, 0);
// v.setParameter(i++, "CONF:CURR:DC DEF");
// v.setParameter(i++, 0);
// v.setParameter(i++, 11);
// v.setParameter(i++, 1);
// v.setParameter(i++, 0);
// v.invoke();
// int ret = Integer.parseInt(v.getRetVal());
// System.out.println(ret);
报如下的错误:
Exists
Exception in thread "main" org.xvolks.jnative.exceptions.NativeException: DLL C:/WINDOWS/system32/gpib-32.dll not found
at org.xvolks.jnative.JNative.nLoadLibrary(Native Method)
at org.xvolks.jnative.JNative.loadLibrary(JNative.java:545)
at org.xvolks.jnative.JNative.<init>(JNative.java:521)
at org.xvolks.jnative.JNative.<init>(JNative.java:440)
at MyTestJNative.main(MyTestJNative.java:23)
我的dll文件放在windows/system32下面了.而且当前工程对应的classes目录下面也存在,跟当前的class文件放在一起的。
请问这是怎么回事呢?
JNative v = new JNative("C:/WINDOWS/system32/gpib-32.dll","ibdev") ;
这句好像错了,修改成下面的样子:
JNative v = new JNative("gpib-32","ibdev") ;
还是报同样的错误 展开
File file = new File("C:/WINDOWS/system32/gpib-32.dll") ;
if(file.exists())
{
System.out.println("Exists");
}
else
{
System.out.println("error");
}
JNative v = new JNative("C:/WINDOWS/system32/gpib-32.dll","ibdev") ;
// int i = 0;
// v.setRetVal(Type.INT);
// v.setParameter(i++, 0);
// v.setParameter(i++, "CONF:CURR:DC DEF");
// v.setParameter(i++, 0);
// v.setParameter(i++, 11);
// v.setParameter(i++, 1);
// v.setParameter(i++, 0);
// v.invoke();
// int ret = Integer.parseInt(v.getRetVal());
// System.out.println(ret);
报如下的错误:
Exists
Exception in thread "main" org.xvolks.jnative.exceptions.NativeException: DLL C:/WINDOWS/system32/gpib-32.dll not found
at org.xvolks.jnative.JNative.nLoadLibrary(Native Method)
at org.xvolks.jnative.JNative.loadLibrary(JNative.java:545)
at org.xvolks.jnative.JNative.<init>(JNative.java:521)
at org.xvolks.jnative.JNative.<init>(JNative.java:440)
at MyTestJNative.main(MyTestJNative.java:23)
我的dll文件放在windows/system32下面了.而且当前工程对应的classes目录下面也存在,跟当前的class文件放在一起的。
请问这是怎么回事呢?
JNative v = new JNative("C:/WINDOWS/system32/gpib-32.dll","ibdev") ;
这句好像错了,修改成下面的样子:
JNative v = new JNative("gpib-32","ibdev") ;
还是报同样的错误 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询