Bridges > Java Export Bridge > About Java Export Object Examples

# About Java Export Object Examples

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 chapter provides several Java examples that incorporate the use of 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.
  - Nondrawable Java Export Example
- Drawable examples — contain the elements needed to create interactive IDL drawing windows and access to mouse events.
  - Drawable Java Export Examples

Note: 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:

1. Create the object in IDL.
2. 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.
3. 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.
4. Compile and execute the application with a classpath reference to javaidlb.jar.

Note: 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.

Note: 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 chapter 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, described in Debugging Java Wrapper Objects.