wood burning stoves 2.0*
The moose likes Java in General and the fly likes COM object in Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "COM object in Java" Watch "COM object in Java" New topic
Author

COM object in Java

Suman Mummaneni
Ranch Hand

Joined: Dec 14, 2004
Posts: 87
Hi

If I want to use a COM object in Java how do I do it. I need to access a COM dll in my Java class. I can do this using JNI wrapper classe or should I clreate a new DLL for this again.



Suman Mummaneni
Bangalore
India
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41124
    
  45
This article introduces a library for that purpose which is available from IBM Alphaworks. I've never used it, so can't comment on it.


Ping & DNS - my free Android networking tools app
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Google on "Java COM bridge" and find many products ranging from free and unsupported to very expensive. Consider a JNI solution where you call from Java to a custom C++ module you write just to talk to a particular COM object. Let us know what you wind up with!


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Suman Mummaneni
Ranch Hand

Joined: Dec 14, 2004
Posts: 87
Hi

Well for me JNI came to the rescue. I had to write a small C++ class to access some function from another DLL file. So that closed the matter.

-Cheers
Pradeep Kadambar
Ranch Hand

Joined: Oct 18, 2004
Posts: 148
Accessing COM objects has been made simple with Java COM bridges.

For example : JACOB

It is quite efficient. It internally uses JNI for this purpose.

Jayesh Lalwani
Ranch Hand

Joined: Nov 05, 2004
Posts: 502
If you are using COM from JNI, beware of the threading model of the COM object. In-proc COM objects should be fine and simply creating and releasing COM object within your JNI call is fine.

However, if you are creating an out-of-proc COM object in one thread and using it in another, you might run into problems.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: COM object in Java
 
Similar Threads
Accessing Visual Basic DLL from JAVA
A problem concerning registering java COM on ms windows
How do I create a COM+ object with Java?
Calling DLL function
how to register a java class file for com