码迷,mamicode.com
首页 > 其他好文 > 详细

关于使用jacob出现的异常

时间:2016-01-15 22:52:44      阅读:3482      评论:0      收藏:0      [点我收藏+]

标签:

1) 把jacob.jar加载到工程里;
2) 把jacob.dll放入 JAVA_HOME\bin\ 和 JAVA_HOME\jre\bin目录下;
3)  把jacob.dll放入 C:\WINDOWS\system32\下;

常见错误解释:

1、找不到jacob.dll,配置路径问题(确认jacob.dll配置正确)

Exception in thread "……" java.lang.UnsatisfiedLinkError: no jacob 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 com.jacob.com.Dispatch.<clinit>(Dispatch.java:36)
        ……
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)

 

2、找不到资源文件,资源文件路径问题(查看程序中资源文件路径的设置,并检查资源文件的存放路径)

Exception in thread "……" com.jacob.com.ComFailException: Invoke of: Open
Source: Microsoft Word
Description: RCHITECTURE=x86
        at com.jacob.com.Dispatch.invokev(Native Method)
        at com.jacob.com.Dispatch.invokev(Dispatch.java:890)
        at com.jacob.com.Dispatch.callN(Dispatch.java:526)
        at com.jacob.com.Dispatch.call(Dispatch.java:606)
        at WordControl.openDocument(Test06_08_01.java:3027)
        ……
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)

 

3、jacob.dll或jacob.jar对应版本错误

com.jacob.com.ComFailException: A COM exception has been encountered:
At Invoke of: Documents
Description: An unknown COM error has occured.
at com.jacob.com.Dispatch.invokev(Native Method)
at com.jacob.activeX.ActiveXComponent.getProperty(ActiveXComponent.java)
at com.perlong.poa.common.dao.sqlserver.WordToHtml.change(WordToHtml.java:73)
at com.perlong.poa.common.dao.sqlserver.WordToHtml.main(WordToHtml.java:121)
com.jacob.com.ComFailException: A COM exception has been encountered:
At Invoke of: Quit
Description: An unknown COM error has occured.
at com.jacob.com.Dispatch.invokev(Native Method)
at com.jacob.activeX.ActiveXComponent.invoke(ActiveXComponent.java)
at com.perlong.poa.common.dao.sqlserver.WordToHtml.change(WordToHtml.java:92)
at com.perlong.poa.common.dao.sqlserver.WordToHtml.main(WordToHtml.java:121)
Exception in thread "main"

----最后

jacob 就是 JAVA-COM Bridge的缩写,它是在java与微软的com组件之间的桥梁,通过使用jacob自带的dll动态链接库通过JNI的方式实现了在sun java平台上的程序对com调用。jacob的作者照搬了微软java开发包中调用com组件的模式,并将它在sun java平台上实现,可谓是用心良苦啊。

 

来源:http://blog.sina.com.cn/s/blog_613963d10100odq2.html

关于使用jacob出现的异常

标签:

原文地址:http://www.cnblogs.com/yzuzhang/p/5134655.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!