How do I use a COM component in Java?
-
Hi, I read in a book on COM that COM is language independent viz. you can create and use COM components in any language. I was wondering how do I go about using a COM component (created in VC++) in a Java client program? Thanks, Melwyn
There is a Sun-approved way, which is to create a native interface that implements the COM interface, and create a DLL with JNI that implements the native interface using the COM object. This will work with any modern JVM. Microsoft's JVM (which I don't think is supported any longer) had another way, which I don't recall the details of, that let you use a COM object directly from Java.
-
There is a Sun-approved way, which is to create a native interface that implements the COM interface, and create a DLL with JNI that implements the native interface using the COM object. This will work with any modern JVM. Microsoft's JVM (which I don't think is supported any longer) had another way, which I don't recall the details of, that let you use a COM object directly from Java.
Hi, Thank you for your reply. That solved my doubt as far as using a COM component is concerned. How about creating a COM component in Java? Books on COM say that you can creat a COM component in any language....even COBOL!!! I suspect as usual Microsoft people make statements they can't back up. Thanks, Melwyn
-
Hi, Thank you for your reply. That solved my doubt as far as using a COM component is concerned. How about creating a COM component in Java? Books on COM say that you can creat a COM component in any language....even COBOL!!! I suspect as usual Microsoft people make statements they can't back up. Thanks, Melwyn
Again, there is a Microsoft JVM-specific way which is (supposed to be) simple-- and the JNI way, in which case you create a C/C++ COM wrapper for your Java object. The wrapper would incorporate the JVM and call it to process COM requests in your Java object.