Java "Count" Tutorial


(Note: Most of these steps assume you have Visual J++ installed)

Step 1: Create IDL

Write the DCOM IDL for the DCOM object. This is where you define all interfaces for you object. You will want to generate GUIDs (Globally Unique Identifiers) for each class and interface. This can be done using the GUID generation utility in Microsoft's Developer Studio. Compile the IDL using the MIDL compiler. This will generate the type library (.TLB) file for your classes.

Step 2: Generate Type Lib

Next you will want to generate the Java wrappers for the DCOM class. Run the TLB file through the JavaTLB utility. This tool generates .class files for every DCOM interface. In addition, it will generate a summary.txt file that contains a Java interface definition template for your DCOM class.

Step 3: Write Client & Server

Implement the DCOM class in Java. You must implement all interfaces that you defined in your IDL. Then, compile the Java class using the jvc compiler. Once compiled, you must now register the Java class. This can be done with the JavaReg tool. JavaReg will create a NT or Win95 registry value for your class.

Step 4: Compile, Register, Run

Write your client code, then compile it. Now come the fun part! You will have to register your client code, which at the present time is an absolute mess. Depending upon where and what your client is, you will have to use a combination of JavaReg, DCOMCNFG, and RegEdt32 to accomplish this. See the references for help on registering a DCOM class on a client. During our project development, this task was completed for us because we developed and ran the client on the same machine as the server.

This make.bat file can perform most of these steps for you. Once these steps are completed, you should be able to run the client application using jview.

For a good visual representation of the Java/DCOM development process, click here.