Call COM object

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

Then we are able to call WSH objects/methods.

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

https://com4j.dev.java.net/

j-interop

Implementation of DCOM wire protocol (MSRPC) to enable development of Pure Bi-Directional, Non-Native Java applications which can interoperate with any COM component. The implementation is itself purely in Java and does not use JNI to provide COM access.

http://sourceforge.net/projects/j-interop

j-xchange

Pure java implementation of the entire Collaboration Data Objects (CDO 1.21) library for accessing Microsoft Exchange Server in a platform independent manner.

http://sourceforge.net/projects/j-xchange/


See also this HowTo for an alternative package to access a COM package from Java.





If you find this article useful, consider making a small donation
to show your support for this Web site and its content.

Written and compiled by Réal Gagnon ©1998-2010
[ home ]