Hi there,
I need to call a dll file that was written in VB.Net, in my java application using the jacob [com.jacob.com] ,
after successfully registering the dll file, I am trying to instantiate an ActiveXComponent object using my dll, :

ActiveXComponent myComp = new ActiveXComponent("Myfile.dllfile");

where Myfile.dllfile is currently placed in regedit under HKCR,

but running the application give me the following exception :

com.jacob.com.ComFailException: Can't co-create object
at com.jacob.com.Dispatch.createInstance(Native Method)

any help please? what I am missing.
Thanks in advance.

7 Years
Discussion Span
Last Post by muscailie

Can you see Myfile.dllfile in olewiew?
I've used Jacob with iTunes and new ActiveXComponent("iTunes.Application"); works 100%. If you have iTunes maybe you could see if that works for you.
Alternatively, have a look at com4j (Google it). It's not as smart as Jacob in terms of its thread handling, and can't handle as wide a range of COM interfaces, but when it works it's 100% easier to use.


Thanks for replying,

Can you see Myfile.dllfile in olewiew?

I am afraid that I have no idea about "olewiew" !

in addition I do not have the iTunes,
and the jacob worked fine with the already installed files such (word.application , excel ....... etc) , but not with the registered dll file.
trying any other alredy exist files such the word.Basic, works very nice ,



oleview is an old Microsoft utility that lets you browse the complete interface definitions for all registered COM objects etc.
It gets the info directly from the objects, so it's the most current and credible source, and will immediately show if your problem is with the object or Jacob. If you Google it you'll be able to track down a legit. download source.
I agree about Jacob working well; I've not hit anything yet that it can't cope with. The hardest thing is to make sure that you have released every comthread properly at the end of the run (including the swing EDT and any callbacks from COM), otherwize you can get problems trying to run your app a second time without re-starting the server.
I do think it's pretty hard to use - you have to experiment to find out what kind of objects to pass it, and what kind it returns, and you can only do that at runtime. Com4j pre-processes the COM interface and generates a complete set of type-safe Java wrappers, so it's very much easier to use. (Jacob has an unfinished wrapper generator, but I've never been able to get it to work). For serious apps I use Com4j to get all the calls and logic right, then replace them with the Jacob equivalents for reliability and speed.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.