943,865 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Unsolved
  • Views: 4629
  • Java RSS
May 21st, 2009
0

calling dll from java application using Jacob

Expand Post »
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, :

Quote ...
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 :

Quote ...
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.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
knowledgelover is offline Offline
86 posts
since Nov 2007
May 21st, 2009
0

Re: calling dll from java application using Jacob

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.
Featured Poster
Reputation Points: 1924
Solved Threads: 951
Posting Expert
JamesCherrill is offline Offline
5,788 posts
since Apr 2008
May 21st, 2009
0

Re: calling dll from java application using Jacob

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 ,

suggestions!
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
knowledgelover is offline Offline
86 posts
since Nov 2007
May 21st, 2009
0

Re: calling dll from java application using Jacob

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.
Featured Poster
Reputation Points: 1924
Solved Threads: 951
Posting Expert
JamesCherrill is offline Offline
5,788 posts
since Apr 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: getdetails(java.lang.String[]) cannot be applied to ()
Next Thread in Java Forum Timeline: testing





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC