More About Java and COM Integration |
![]() Previous |
![]() Introduction |
![]() Index |
![]() Next |
Java integrates seamlessly with COM, even though they were developed separately. In computing, often two very different technologies are required to work together. Although Java and COM are very different, they are complementary to each another.
The following table will help you make a clear distinction between Java and COM. Because the technologies share common attributes, such as being object-oriented and general purpose, there is a tendency to somehow compare the technologies as though they were designed to solve the same problem.
Attribute | Java | COM |
Programming language | Yes | No |
Language independent component Architecture | No | Yes |
Virtual machine | Yes | No |
Simple | Yes | Yes |
Robust | Yes | Yes |
Object-oriented | Yes | Yes |
Platform independent | Yes | Yes |
General purpose | Yes | Yes |
Multi-threaded | Yes | Yes |
Distributed | No | Yes |
Java is a great programming language for both implementing and using COM objects.
Java makes some of the more obscure and error-prone aspects of COM programming easy. While Java is relatively new, it is already recognized as a great programming language. Enabling Java to create and use COM objects makes it a great programming language for COM.
COM makes Java a distributed language.
Every public Java class is a COM object and can be called remotely, just like any other COM object. COM and DCOM (distributed version of Component Object Model) are actually the same thing. The real difference between COM and DCOM is the length of the "wire" between the two software components. Any COM object can be used remotely or locally; this is called location independence. As a result, any COM object developed in Java can be executed on a remote server as well as on the client computer.
COM gives Java direct access to native code.
Any COM object appears as a Java object to the Java programmer. There is no need for large class libraries that wrap existing objects: The existing objects can be called directly.
Java and COM integrate together seamlessly.
The integration of Java and COM by the Microsoft Win32 VM for Java does not interfere or conflict in any way with the "spirit" of Java.
Integrating Java and COM preserves existing technology investments while new technologies can be utilized. Java code can call, very naturally, into any ActiveX™ component, whether it is a control or Microsoft™ Excel. Likewise, any ActiveX™ component can call into any Java component. There is no need for new programming models and additional "layers" that technologies such as CORBA have.
Note This article repeatedly refers to COM. Doing so includes almost everything that has been previously known as OLE Automation. OLE Automation was originally designed to accommodate higher level programming languages access to COM objects. As time went by, more and more pieces of OLE Automation were utilized by various OLE initiatives. OLE Automation use is no longer limited to high-level language integration.
© 1997 Microsoft Corporation. All rights reserved. Legal Notices.