An IDL object can wrapped for use in a Java application using the Export Bridge Assistant. For valuable information on the theory and architecture of a wrapper object created by the Export Bridge Assistant, see Using the Export Bridge Assistant.
This section provides several Java examples that incorporate using Java export objects. These include:
- Nondrawable examples: Show how to access the processing power of IDL in a Java application by exchanging data with the IDL process, issuing IDL commands, accessing IDL output.
- Drawable examples: Contain the elements needed to create interactive IDL drawing windows and access to mouse events.
You can quickly incorporate the processing power of IDL in a Java application by including the pre-built Java connector wrapper object in your external application. Use this option if you do not need custom methods or an interactive drawing surface. See Using the Connector Object for details and examples.
The general process for each of these examples involves the following:
- Create the object in IDL.
- Export the object using the Export Bridge Assistant, which creates the files associated with the IDL object that is now wrapped in a Java export object wrapper.
- Access the object in a Java application.This functionality automatically includes stock methods (described in Using Exported Java Objects) in addition to custom methods you have chosen to export.
- Compile and execute the application with a classpath reference to javaidlb.jar.
See Writing IDL Objects for Exporting for information on how to create custom IDL objects that can be successfully exported using the Export Bridge Assistant. There are important object method and data type requirements that must be met.
When you distribute an application, you will also need to share:
- The executable (.class) file(s) including those generated by the Assistant
- The .pro or .sav file that contains the custom IDL object definition
Any .pro or .sav files included with your application must be located in the IDL path. Also, IDL_DIR/resource/bridges/export/java/javaidlb.jar must be in the Java classpath.
Note on Running the Java Examples
Examples in this section provide Windows-style compile javac (compile) and java (run) commands. If you are running on a platform other than Windows, use your platform’s path and directory separators and see Java Requirements for information about the bridge_setup file, which sets additional information.
Debugging Applications Using Export Objects
It can be challenging to determine what is happening in the IDL process associated with a wrapper object without the debugging features of the IDL Workbench. For access to valuable debug information, consider using the IDL_BRIDGE_DEBUG environment variable, as described in Debugging Java Wrapper Objects.