Creating a Java Description of COM Components

This article has three sections:
See the sample or the readme.

What is the Java Type Library Wizard?

The Java Type Library Wizard is a tool that reads type libraries from .TLB, .OLB, .OCX, .DLL, and .EXE files and creates Java class files with information about the COM interfaces and methods. These class files are needed for both compiling and running a Java project using COM components.

Return to the top of this article.


Using the Java Type Library Wizard

To create a Java description of COM components:

  1. From the Tools menu in Microsoft® Developer Studio, choose Java Type Library Wizard.
    The Java Type Library Wizard dialog box appears.
  2. From the list, select the COM component(s) you want, check the box to the left of the name.
    For this sample, select Microsoft Outline Control.
  3. Click OK.
    The Java Type Library Wizard processes the selected type libraries and creates Java descriptions of the selected COM components.
Return to the
top of this article.

Output from the Java Type Library Wizard

After you have created Java descriptions of COM components, the output window shows two useful types of information, the import statement and the SUMMARY.TXT notice.

The import statement

After the Java Type Library Wizard is finished, the output window displays a Java import statement. In this sample:

   import msoutl32.*;

Typically, you copy this line of text and insert it into the beginning of any Java source file that uses the COM component. This has been done for you in this sample; see line 8 in orgchart.java.

The summary.txt line

Following the import statement, the output window has lines saying that the file SUMMARY.TXT has been created. This file lists the interfaces and classes in the Java description of the type library. Use this file to check the types for the parameters and return values in the methods.

You will note that there are no methods listed for any of the classes. Recall when calling COM from Java, you will use the class file to create the COM component, but you must use the interface file to access the COM component.

Double-click the SUMMARY.TXT line to view that file in Developer Studio.

Return to the top of this article.