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 code.output.dir -p project.namespace %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));
  }
}

 

posted on 2019-09-30 17:40  空明流光  阅读(2126)  评论(0编辑  收藏  举报

导航