Microsoft SDK for Java

Using Java Objects in COM

Exposing a Java object as a COM component requires that the Java object be contained inside a COM-Callable Wrapper (CCW). The CCW is a generic COM object that has its virtual table (vtable) of function pointers dynamically constructed to support some default COM interfaces as well as any COM interfaces implemented by the Java object. This neutrally presents the Java object for all other COM components and COM-compliant languages to use.

The Microsoft VM dynamically creates a CCW for the Java object when a COM object is required. The default COM interfaces exposed for every Java/COM object by the CCW allow Java objects to be used as functional COM objects. The CCW exposed for a Java object is capable of being aggregated, but cannot aggregate other COM objects. The Microsoft VM takes care of storing the pointer to the outer COM object's IUnknown interface in the CCW.

The CCW provides the following default COM interfaces for Java objects:

Override most of these interfaces by implementing them. The Java object's COM interface method implementations are added to the vtable instead of the CCW's COM interface method implementations. Although IUnknown, IExternalConnection, and ISupportErrorInfo cannot be overridden, the Microsoft VM automatically deals with these interfaces. Therefore, you don't have to track reference counts, query for interfaces, or propagate exceptions for Automation objects.

The CCW implements the appropriate COM interfaces under the following circumstances:

For details on the specific COM interfaces that are implemented, see the Integrating Java and COM white paper.

© 1999 Microsoft Corporation. All rights reserved. Terms of use.