Nondrawable objects provide access to the enormous processing power of IDL, but do not provide IDL drawing capabilities. This is useful for applications that need the data manipulation capabilities of IDL, but have no need for, or have independent drawing capabilities.

Hello World Java Example with Additional Method

The following simple example creates an IDL object with a single function method that accepts one argument, and walks through the process of exporting the object using the Export Bridge Assistant. Once the export files are created, a simple Java application shows how to access the object method and capture its output.

Complete the following steps to duplicate this example.

  1. In an IDL Editor window, copy in the following code and save the file as in your working directory:
  2. ; Method returns message based on presence or
    ; absence of argument.
    FUNCTION helloworldex::HelloFrom, who
      message = "Hello World from " + who RETURN, message
      message = 'Hello World' RETURN, message
    ; Init returns object reference on successful
    ; initialization.
    FUNCTION helloworldex::INIT
      RETURN, 1
    ; Object definition.
    PRO helloworldex__define
      struct = {helloworldex, $
      who: '' , $
      message: ' '}

    Note: It is a good idea to test the functionality of an object before exporting it. After compiling the file, enter the following lines at the command line and make sure the output is what is expected for this object.

    ohello = OBJ_NEW("HELLOWORLDEX")
    PRINT, ohello->HelloFrom()
    PRINT, ohello->HelloFrom('Mr. Bill')
  3. Open the Export Bridge Assistant by entering IDLEXBR_ASSISTANT at the command line.
  4. Select to create a Java export object by selecting File > New Project > Java and browse to select the file. Click Open to load the file into the Export Assistant.
  5. Note: Export Bridge Assistant details are available in Specifying Information for Exporting. Refer to that section if you need more information about the following steps.

  6. The top-level project entry in the left-hand tree panel is selected by default.
  7. There is no need to modify the default properties shown in the right-hand property panel, but you can enter different values if desired. Set other export object characteristics as described in the following table. Select the tree view item listed in the left column to configure the related properties in the right column.

    Tree View Item

    Parameter Configuration

    IDL Export Bridge Project

    Accept the default value or make changes:

    • Output classname
    • Process name
    • Output directory


    Drawable object equals False

    Package name


    HELLOFROM method

    Output method name: Accept the default value, HELLOFROM

    Return Type: JIDLString since this function method returns a string message (as defined in the IDL object definition structure)

    Array: False since this method returns a single string, not an array

    Export: True

    WHO argument

    Mutability: In since the argument is not passed back to the caller

    Type: JIDLString since this argument is defined as a string in the IDL object definition

    Array: False

    Export: True

  8. Save the project by selecting File > Save project. Accept the default name and location or make changes as desired.
  9. Verify that the object elements you want to export are listed in the Export log panel. If the expected items are not present, one or more items may still have an UNSPECIFIED field value that must be changed.
  10. Build the export object by selecting Build > Build object. The Build log panel shows the results of the build process. A subdirectory, named helloworldex (based on the object name), contains the .java and .class files, and is located in the Output directory.

Using the Export Wrapper Object

The following simple Java application uses the wrapper object created in the previous section.

Note: The file for this example,, is located in the examples/doc/bridges/java subdirectory of the IDL distribution.

  1. Open the file named in the previously referenced directory and save the file in the helloworldex directory.
  2. Open the Windows Command window by selecting Start > Run and enter cmd in the textbox.
  3. Use the cd command to change to the directory containing the helloworldex directory.
  4. Reference the classpath of javaidlb.jar in the compile statement. Enter the following two commands (as single lines) to compile and execute the program, replacing IDL_DIR with the IDL installation directory:
javac -classpath ".;IDL_DIR\resource\bridges\export\java\javaidlb.jar" helloworldex\
java -classpath ".;IDL_DIR\resource\bridges\export\java\javaidlb.jar" helloworldex.helloworldex_example

Tip: See Note on Running the Java Examples for information on executing Java commands on a non-Windows platform.

After compiling and running the project, the output message will appear in the command window.