Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Any method for accessing Windows COM methods using Java?

Tags:

java

windows

com

I have an application which makes use of JNA to call functions from a hardware abstraction library in C++. One of the supported hardware devices requires Windows COM subsystem to be initialized (via CoInitialize or CoInitializeEx).

Does anybody know any Java library which can do the trick? I know I could wrap some Windows functions, but if I had something ready and tested, that would be better. I found one called JACOB but it is said that the documentation is not good and it's been a long time since they last updated it.

Thanks!

like image 554
jfsantos Avatar asked Feb 09 '11 16:02

jfsantos


2 Answers

We use Com4J (for external processes like Excel) and the SWT COM API (for embedded GUI components). Sometimes, we use Jacob, it depends on the control you want to control. Sometimes they don't implement the IDispatch interface correctly, and then only one of the Java Com APIs works.

We also had COM components that needed a VB6 wrapper DLL, which in turn can be called with Com4J, so prepare for some headaches!

like image 143
Daniel Avatar answered Nov 07 '22 11:11

Daniel


Have a look @ JCom (Java-COM Bridge)

Other implementation exist but I used this one and it worked for me..

like image 28
Stephen Gennard Avatar answered Nov 07 '22 12:11

Stephen Gennard