Jacob's configuration method and two Common Errors
Jacob can easily program MS components such as word. I have written a document about how to use Jacob to convert Word documents into HTML and other formats (
Http://blog.csdn.net/guoxiaoshou2000/archive/2004/12/07/208024.aspx
), And the source code is attached.
However, some of my friends recently contacted me and said they could not correctly execute the code I provided. The error message is as follows:
Com.jacb.com. comfailexception: invoke failed: specified ents at com.jacb.com. Dispatch. invo50nm (native method)
Com. Jacob. ActiveX. activexcomponent. getproperty (activexcomponent. Java) at wordtohtml. Change (wordtohtml. Java: 62)
At wordtohtml. Main (wordtohtml. Java: 104)
Com.jacb.com. comfailexception: invoke failed: Quit
At com.jacb.com. Dispatch. invo50nm (native method)
At com. Jacob. ActiveX. activexcomponent. Invoke (activexcomponent. Java) at wordtohtml. Change (wordtohtml. Java: 77) at wordtohtml. Main (wordtohtml. Java: 104)
Exception in thread "Main"
I have encountered this error before. Here I will describe my solution.
One reason for this error is that JDK does not match your Jacob version. If you use JDK or later, this error will certainly occur, you can upgrade your Jacob. dll version-the file name can be downloaded on the Yahoo Jacob discussion group: jacb_jre142fix_bin.
In addition, the upgrade may still cause errors. In this case, the following configuration method is recommended.
JDK 1.3.1 _ 15 + Jacob. Jar 1.7 + Jacob. dll version of jre142fix_bin
JDK can be downloaded directly from Sun's website. The download link is:
Http: // 192.18.97.50/ECOM/ecomticketservlet/beginbb924c3a202206be2fd20be583f482/-2147483648/829060395/1/557666/557654/829060395/2ts +/westcoastfsend/j2sdk-1.3.1_15-oth-JPR/j2sdk-1.3.1_15-oth-JPR: 7/j2sdk-1_3_1_15-windows-i586.exe
Note: After the download is complete, it is a file with a long name and renamed JDK. 1.3.20.15.exe.
Jacob. Jar 1.7 is as follows:
Http://danadler.com/jacob/jacobSrc_17.zip
Note: Do not use the Jacob. dll provided in it.
Jacob. dll can be downloaded from the Jacob discussion group of Yahoo ).
After downloading all the files. jar decompress and add the files in COM and META-INF to the tools in JDK Lib. jar. dll can be directly placed in system32.
Note that if your Jacob. jar and Jacob. dll versions are inconsistent, the following error may occur:
Exception in thread "Main" Java. Lang. unsatisfiedlinkerror: No Jacob in Java. LiBr
Ary. Path
At java. Lang. classloader. loadlibrary (classloader. Java: 1344)
At java. Lang. runtime. loadlibrary0 (runtime. Java: 744)
At java. Lang. system. loadlibrary (system. Java: 815)
At com.jacb.com. Dispatch. <clinit> (dispatch. Java)
At openword. Open (openword. Java: 12)
At openword. Main (openword. Java: 48)
Or:
Exception in thread "Main" Java. Lang. unsatisfiedlinkerror: docoinitialize
At com.jacb.com. comthread. docoinitialize (native method)
At com.jacb.com. comthread. INIT (comthread. Java)
At com.jacb.com. comthread. initmta (comthread. Java)
At com.jacb.com. Rot. addobject (rot. Java)
At com.jacb.com. jacobobject. <init> (jacobobject. Java)
At com.jacb.com. Dispatch. <init> (dispatch. Java)
At com. Jacob. ActiveX. activexcomponent. <init> (activexcomponent. Java)
At openword. Open (openword. Java: 12)
At openword. Main (openword. Java: 48)
Pay special attention to this.
Well, all the configuration here is complete, the above is some of my experience, if there is something wrong, please go to my blog (http://blog.csdn.net/guoxiaoshou2000) Tell me.
The above method has been tested by myself. If this configuration is used, it should be okay-but if you cannot use jdk1.3, you can try other methods by yourself, I will continue my research if I have time. Good luck!