日期:2014-05-20  浏览次数:20932 次

给分了,大虾们紧急问题,jacob生成word表格问题
我已将jacob.dll放到了system32与jdk的jre/bin下,
在新建 new ActiveXComponent("Word.Application"); 时报错

Exception in thread "main" java.lang.UnsatisfiedLinkError: com.jacob.com.Dispatch.createInstanceNative(Ljava/lang/String;)V
at com.jacob.com.Dispatch.createInstanceNative(Native Method)
at com.jacob.com.Dispatch.<init>(Dispatch.java:160)
at com.jacob.activeX.ActiveXComponent.<init>(ActiveXComponent.java:54)
at WordBean.<init>(WordBean.java:12)
at JacobTest2.insertTableTest(JacobTest2.java:34)
at JacobTest2.mergeTableCellTest(JacobTest2.java:44)
at JacobTest2.main(JacobTest2.java:56)


------解决方案--------------------
把jcob.jar的路径放置在classpath目录下
------解决方案--------------------
我的没有这种问题,试着注册一dll呢。
regsvr32 -s jacob.dll
------解决方案--------------------
Dispatch docs = app.getProperty("Documents").toDispatch();