Create a Java file named idlexfoo_example.java and save it in the Export directory created by the Assistant. Include the following lines of code in the file:
// Reference the default package generated by the Assistant.
package idlexfoo
// Reference the javaidl export bridge classes.
import com.idl.javaidl.*
//Create main class, subclassing from object created by
//Bridge Assistant. You can either subclass or create a
//member variable of the object.
public class idlexfoo_example extends idlexfoo implements JIDLOutputListener
{
//Create a variable referencing the exported object
private idlexfoo fooObj
// Constructor.
public idlexfoo_example()
{
>// Create the wrapper object
fooObj = new idlexfoo()
// Add output listener to access IDL output.
fooObj.addIDLOutputListener(this)
// Create the underlying IDL object and call
// its ::Init method with parameters
fooObj.createObject( )
fooObj.executeString("PRINT, 'Created object'")
}
// Implement JIDLOutputListener
public void IDLoutput(JIDLObjectI obj, String sMessage)
{
System.out.println("IDL: "+sMessage)
}
//Instantiate a member of the class.
public static void main(String[] argv)
{
idlexfoo_example exampleObj = new idlexfoo_example()
}
}