Java/COM integration lets you combine Java's advantages with COM and develop components that can interact with operating systems, applications, and services written in any COM-compliant language on any platform.
Most of the Microsoft® Windows® functionality is exposed through COM, and most Microsoft applications provide COM interfaces to their object models. At the same time, Java offers automatic garbage collection and replaces pointers with references, while the Microsoft virtual machine (Microsoft VM) automatically handles object references, cleanup, and interface queries for any COM object used in Java, whether the component was written in Java or another COM-compliant language. The VM also provides automatic mapping, allowing a Java object to be a COM object, and allowing any COM object to be accessible as a Java object.
This topic covers the following information:
Using COM Objects in Java describes how COM objects are exposed as if they were Java objects by using Java-Callable Wrappers (JCWs) and compiler directives.
Using Java Objects in COM describes how Java objects are exposed as COM components by using COM-Callable Wrappers (CCWs).
Using Jactivex with COM shows how to use jactivex to generate .java files for the classes and interfaces of a type library.
Type Mappings between Java and COM shows the correspondence of non-Java data types with Java data types.
Handling COM Errors in Java discusses HRESULTs and try-catch error-handling blocks.
Apartment Model and Threading Issues describes how the Microsoft VM instantiates COM objects and creates marshaling proxies.
Standard Java/COM Marshaling describes how dissimilar data types are handled and wrapped by the Microsoft VM.
Custom Java/COM Marshaling discusses the marshaling of complex COM library data types with user-defined Java types and hook classes.
Integrating JavaBeans and ActiveX describes how a JavaBean can be hosted by a Microsoft® ActiveX® container, and an ActiveX Control can be hosted by a JavaBean container.
The Java/COM integration features in the Microsoft VM provide access to COM objects from a Java application or exposes Java classes as COM objects. COM objects can be ActiveX Controls or Automation objects that are exposed by an application such as Microsoft® Excel. ActiveX controls are Automation-enabled controls that support the IDispatch COM interface, enabling the control to be scripted.
The Microsoft VM hosts ActiveX Controls in Java. Automation objects (a local application or COM server) may also be accessed from a Java process. The Java/COM integration features in the Microsoft VM and the Microsoft SDK for Java facilitate exposure of Java classes as COM objects for use by other Microsoft® Win32® processes.
The jactivex tool (in this SDK) emits Java source code wrappers for the interfaces implemented by a COM object when used on an ActiveX control, an Automation DLL, an Automation server, or a type library. For ActiveX controls, the emitted Java code includes JavaBean-like code for adding and removing listeners for the events originating from the ActiveX control. It also includes code to appropriately manage the control for its lifetime. For a jactivex overview, see Using Jactivex with COM. For all jactivex command-line arguments, see Jactivex in the Tools Reference.
Compiler Directives and Attributes Reference
Using COM Objects in Java (Programmer's Guide)
Using COM Objects from Java (White Paper)
Integrating Java and COM (White Paper)