OS:Win2000Pro我先是把jacob的JAR的classpath设置好后,jacob.dll放在PATH里后,抄用的是这段代码。
import java.io.File;
import com.jacob.com.*;
import com.jacob.activeX.*;public class FileExtracter{
 public static void main(String[] args) {
  ActiveXComponent component = new ActiveXComponent("Word.Application");
  String inFile = "c:\\test.doc";
  String tpFile = "c:\\temp.htm";
  String otFile = "c:\\temp.xml";
  boolean flag = false;
  try {
   component.setProperty("Visible", new Variant(false));
   Object wordacc = component.getProperty("document.").toDispatch();
   Object wordfile = Dispatch.invoke(wordacc,"Open", Dispatch.Method, 
                                     new Object[]{inFile,new Variant(false), new Variant(true)},
                                     new int[1] ).toDispatch();
   Dispatch.invoke(wordfile,"SaveAs", Dispatch.Method, new Object[]{tpFile,new Variant(8)}, new int[1]);
   Variant f = new Variant(false);
   Dispatch.call(wordfile, "Close", f);
   flag = true;
  } catch (Exception e) {
   e.printStackTrace();
  } finally {
   component.invoke("Quit", new Variant[] {});
  }
 }
但是ActiveXComponent component = new ActiveXComponent("Word.Application");
这段代码就报错了,报java.lang.UnsatisfiedLinkError: no jacob in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1491)
at java.lang.Runtime.loadLibrary0(Runtime.java:788)
at java.lang.System.loadLibrary(System.java:834)
at com.jacob.com.Dispatch.<clinit>(Dispatch.java)
at test.Form.main(Form.java:29)
请问是什么原因,大家有没有做成功的例子代码,