JACOB调用报错:Can't co-create object

邹峰 发布于 2016/05/11 11:58
阅读 3K+
收藏 0

window64位服务器,在myeclipse里调用jacob出错,用的是jacob-1.17-M2-x64.dll

代码:

import com.jacob.com.Dispatch;


public class jacobtest {


public static void main(String[] args) {
// TODO Auto-generated method stub
String result = "";
System.out.println(System.getProperty("java.library.path"));
try {
Dispatch ids = new Dispatch("MailServerCtrl.MailDBInterface");

//Set Winmail database path
Object[] param1 = new Object[]{"E:\\Magic WinMail\\server"};

Dispatch.call(ids, "InitControl", param1);


//Add new mail user
Object[] param2 = new Object[]{"testtest", "jinying.com", "Mail123"};
result = String.valueOf(Dispatch.call(ids, "AddUser", param2));

System.out.println("result: "+result);
ids.safeRelease();
}
catch(Exception e) 
{
e.printStackTrace();
}
}


}


报错信息:com.jacob.com.ComFailException: Can't co-create object
at com.jacob.com.Dispatch.createInstanceNative(Native Method)
at com.jacob.com.Dispatch.<init>(Dispatch.java:99)
at weaver.interfaces.winmail.jacobtest.main(jacobtest.java:12)


加载中
返回顶部
顶部