java调用com组件com4j

Posted nanfei

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了java调用com组件com4j相关的知识,希望对你有一定的参考价值。

com4j

A Java library that allows Java applications to seemlessly interoperate with Microsoft Component Object Model.

First generate Java type definitions from a COM type library. Here we are doing for the type library for the Windows Scripting Host.

> java -jar tlbimp.jar -o wsh -p test.wsh %WINDIR%\system32\wshom.ocx

 代码:

public class Main 
  public static void main(String[] args) 
    IFileSystem3 fs = ClassFactory.createFileSystemObject();
    for( String file : args )
      System.out.println(fs.getFileVersion(file));
  

 

以上是关于java调用com组件com4j的主要内容,如果未能解决你的问题,请参考以下文章