Java com4j包装机问题

Java com4j包装机问题,java,tlbimp,com4j,Java,Tlbimp,Com4j,我正在尝试使用tlbimp-20110320.jar为com4j生成包装器。我还尝试了一个2008版本,但出现了相同的错误。即使在图坦卡蒙的例子中,我也会遇到同样的错误 C:\Users\matthew\Documents\NetBeansProjects\test>"C:\Program Files (x86)\Java\jr e7\bin\java.exe" -jar tlbimp-20110320.jar -o excel -p excel "C:\Program Files (x

我正在尝试使用tlbimp-20110320.jar为com4j生成包装器。我还尝试了一个2008版本,但出现了相同的错误。即使在图坦卡蒙的例子中,我也会遇到同样的错误

C:\Users\matthew\Documents\NetBeansProjects\test>"C:\Program Files (x86)\Java\jr
e7\bin\java.exe" -jar tlbimp-20110320.jar -o excel -p excel "C:\Program Files (x
86)\Microsoft Office\Office14\EXCEL.EXE"
Exception in thread "main" java.lang.NoClassDefFoundError: org/kohsuke/args4j/Cm
dLineException
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
    at java.lang.Class.getMethod0(Unknown Source)
    at java.lang.Class.getMethod(Unknown Source)
    at sun.launcher.LauncherHelper.getMainMethod(Unknown Source)
    at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.kohsuke.args4j.CmdLineException

    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    ... 6 more
在Iceman提供了一个指向所需库的链接后,我能够让它运行一点。但是,我必须将arg4j内容复制到tlbimp jar中,将com4j内容也复制到tlbimp jar中。现在我明白了

C:\Users\matthew\Documents\NetBeansProjects\test>"C:\Program Files (x86)\Java\jr
e7\bin\java.exe" -jar tlbimp-20110320.jar -o excel -p excel "C:\Program Files (x
86)\Microsoft Office\Office14\EXCEL.EXE"
Generating definitions from Excel
A referenced type library "Office" is generated into the same package "excel"
Unable to handle the type SAVEARRAY(Variant)*
  method ConnectData
  interface IRtdServer
A referenced type library "VBIDE" is generated into the same package "excel"
Exception in thread "main" java.lang.NullPointerException
    at com4j.tlbimp.driver.Driver$1.resolve(Driver.java:64)
    at com4j.tlbimp.Generator$LibBinder.<init>(Generator.java:382)
    at com4j.tlbimp.Generator.getTypeLibInfo(Generator.java:686)
    at com4j.tlbimp.Generator.getTypeName(Generator.java:663)
    at com4j.tlbimp.TypeBinding.bind(TypeBinding.java:173)
    at com4j.tlbimp.MethodBinder.declareReturnType(MethodBinder.java:542)
    at com4j.tlbimp.MethodBinder.declareWithDefaults(MethodBinder.java:399)
    at com4j.tlbimp.MethodBinder.declare(MethodBinder.java:118)
    at com4j.tlbimp.InvocableInterfaceGenerator.generateMethod(InvocableInte
rfaceGenerator.java:39)
    at com4j.tlbimp.InterfaceGenerator.generate(InterfaceGenerator.java:94)
    at com4j.tlbimp.Generator$LibBinder.generate(Generator.java:491)
    at com4j.tlbimp.Generator.generate(Generator.java:112)
    at com4j.tlbimp.driver.Driver.run(Driver.java:107)
    at com4j.tlbimp.driver.Main.doMain(Main.java:132)
    at com4j.tlbimp.driver.Main.main(Main.java:56)
C:\Users\matthew\Documents\NetBeansProjects\test>“C:\Program Files(x86)\Java\jr
e7\bin\java.exe“-jar tlbimp-20110320.jar-o excel-p excel”C:\Program Files(x
86)\Microsoft Office\Office14\EXCEL.EXE“
从Excel生成定义
引用的类型库“Office”生成到同一个包“excel”中
无法处理类型SAVEARRAY(变量)*
方法连接数据
接口IRtdServer
引用的类型库“VBIDE”生成到同一个包“excel”中
线程“main”java.lang.NullPointerException中出现异常
位于com4j.tlbimp.driver.driver$1.resolve(driver.java:64)
位于com4j.tlbimp.Generator$LibBinder。(Generator.java:382)
在com4j.tlbimp.Generator.getTypeLibInfo(Generator.java:686)
位于com4j.tlbimp.Generator.getTypeName(Generator.java:663)
在com4j.tlbimp.TypeBinding.bind(TypeBinding.java:173)
在com4j.tlbimp.MethodBinder.declareReturnType(MethodBinder.java:542)
位于com4j.tlbimp.MethodBinder.declareWithDefaults(MethodBinder.java:399)
位于com4j.tlbimp.MethodBinder.declare(MethodBinder.java:118)
at com4j.tlbimp.InvocableInterfaceGenerator.generateMethod(InvocableInte
rfaceGenerator.java:39)
在com4j.tlbimp.InterfaceGenerator.generate(InterfaceGenerator.java:94)
位于com4j.tlbimp.Generator$LibBinder.generate(Generator.java:491)
在com4j.tlbimp.Generator.generate(Generator.java:112)
在com4j.tlbimp.driver.driver.run(driver.java:107)
位于com4j.tlbimp.driver.Main.doMain(Main.java:132)
位于com4j.tlbimp.driver.Main.Main(Main.java:56)

从堆栈跟踪来看,java类路径中似乎缺少依赖JAR。该程序似乎正在寻找Koshuke的args4j库-。

tlbimp-20110320.jar是必需的
注意:com4j-20110320.jar,需要将名称更改为com4j.jar

附加信息 最新版本()的tlbimp需要和。

在此版本中,不需要更改文件名。

Unjar tlbimp.jar并检查其清单。它有一个类路径,其中args4j和com4j必须与tlbimp.jar位于同一目录中,并且需要特定的名称。名称的细节取决于版本,可能包括版本号,也可能不包括版本号。如图所示命名com4j和arg4j,就可以开始了。

好的。我下载了args4j-2.0.19.jar文件,将其卡在/lib中,出现了相同的错误。然后我在同一个目录中尝试了它,但仍然出现了相同的错误。我想我有点用了。我必须将args4j jar内容复制到tlbimp jar中。然后我得到了一个不同的错误,我只能通过对com4j内容执行相同的操作来解决。在生成NPE之前,它开始运行了一段时间。从那时起,这方面有什么进展吗?