The Java createObject method creates an instance of an underlying IDL object and calls its Init method with any specified parameters (see createObject for details). Through this object instance, you have access to the properties and methods of the object as well as the underlying IDL process.

The following samples rely upon an IDL object contained in file named idlexfoo__define.pro. This file must be in the IDL path and needs to contain the following code:

; The Init method expects three parameters:
; a string, a 32-bit long, and an array which has
; 2 rows & 3 columns, containing 32-bit long values.
; The ::Init method can also be called without any parameters.
 
 idlexfoo::Init, parmStr, parmVal, parmArr, _EXTRA=e
 
   ((parmStr)  1)  
   ( (parmStr,/type)  7 )  
  , 'IDLexFoo::Init, parmStr is not a STRING' , parmStr
  , 0
  
  
   
   ((parmVal)  1)  
   ( ((parmVal,/type)  3) )  
  , 'IDLexFoo::Init, parmVal is not a LONG'
  , parmVal
  , 0
  
  
   
  nElms = (parmArr)
   (nElms  0)  
   ( (nElms  6)  ((parmArr,/type)  3) )  
  , 'IDLexFoo::Init, parmArr is not a ARR(3,2) of LONG)'
  , parmArr
  , 0
  
  
   
  , 1
 

            
 
; Object definition.
 idlexfoo  define
 
  ; Create [col, row] 32-bit long array.
  initArr = (3,2)
  struct = {idlexfoo, $
  parmStr: '', $
  parmVal: 0L, $
  parmArr: initArr $
  }
 

            

Export the Sample IDL Object


You will need to create the necessary wrapper object files by using the Export Bridge Assistant to generate them. Once you have created the object definition file, idlexfoo__define.pro, complete the following steps:

  1. Open the Export Bridge Assistant by entering IDLEXBR_ASSISTANT at the command line.
  2. Select to create a Java export object by selecting File > New Project > Java and browse to select the idlexfoo__define.pro file. Click Open to load the file into the Export Assistant.

    Note: Export Bridge Assistant details are available Using the Export Bridge Assistant. Refer to that section if you need more information about the following steps.

  3. The top-level project entry in the left tree panel is selected by default. There is no need to modify the default properties shown in the right-hand property panel, but you can enter different values if desired. There are no other parameters that need to be defined for this object.

    Tree View

    Item Parameter Configuration

    IDL Export Bridge Project

    Accept the default value or make changes as desired:

    • Output classname
    • Process name
    • Output directory
    • Package name

    idlexfoo

    Drawable object equals False

  4. Save the project by selecting File > Save project. Accept the default name and location or make changes as desired.
  5. Build the export object by selecting Build > Build object. The Build log panel shows the results of the build process. A subdirectory, named idlexfoo (based on the object name), contains the .java and .class files, and is located in the Output directory.

See the following for information on how to create this object in your application:

Note on Running the Java Examples


Examples in this appendix 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.