The java2com tool analyzes Java classes (using Java's reflection mechanism), and outputs:
a COM Interface Definition Language (IDL) file, and
The best way to familiarise yourself with the basics of the java2com tool is to run through one of the step-by-step examples:
There is also a good description of the java2com tool in the Accessing Java objects from COM section.
Start the 'java2com' tool using the command java com.linar.java2com.Main. Make sure that the J-Integra® runtime (jintegra.jar) is in your CLASSPATH environment variable. You can run this tool on any platform.
For Windows users a batch file called java2com.bat is provided in the bin directory. This allows you to launch java2com from any directory as long as the jintegra bin directory is in the PATH and the CLASSPATH is configured correctly.
The 'java2com' tool displays the following dialog box:
The Java Classes & Interfaces
These are the 'root' Java classes/interfaces that you want java2com to analyze. They must be accessible in your CLASSPATH. J-Integra® analyzes these classes/interfaces, and generates COM IDL definitions and Java DCOM marshalling code which can be used to access them from COM. It then performs the same analysis on any classes or interfaces used in parameters or fields in the given classes/interfaces, recursively, until all Java classes and interfaces accessible in this manner have been analyzed.
You can also list JAR files on this line and java2com will analyze all the classes/interfaces contained within those JAR files.
When listing classes or interfaces, type the name without the '.class' at the end. When listing JAR files, type the full name of the JAR file, including the '.jar'.
The IDL File Name
This is the name of the COM Interface Definition Language (IDL) file which will be generated. If you specify 'myjvm', then 'myjvm.idl' will be generated. This name is also used for the name of the type library generated when you compile 'myjvm.idl' using Microsoft's MIDL compiler.
The Output Directory
The directory to which java2com should output the files in generates. The default is the current directory (".").
Click Save Settings to save the current java2com settings.
When java2com starts, it checks to see if there is a java2com.xml setting file in the current directory. If present, it loads the settings from that file automatically.
It is possible to launch java2com form the command line without displaying the graphical user interface. This makes java2com suitable for use within a batch file or other automated build mechanism. In this scenario java2com expects the java2com.xml file to be passed on the command line. It then runs without a GUI and processes the classes specified in the .xml file.
To learn more about the Names... dialog box, please see the Accessing Java objects from COM section.