Previous IDL Connectivity Bridges: Using Java Objects in IDL Next

Showing IDL-Java Output in IDL

By default, IDL prints the output from Java (the System.out and System.err output streams).

For example, given the following Java code:

public class helloWorld  
{  
 // ctor  
 public helloWorld() {  
  System.out.println("helloWorld ctor");  
   }  
  
 public void sayHello() {  
  System.out.println("Hello! (from the helloWorld object)");  
   }  
  
}  

The following output occurs in IDL:

IDL> oJHello = OBJ_NEW('IDLjavaObject$HelloWorld', 'helloWorld')  
% helloWorld ctor  
IDL> oJHello -> SayHello  
% Hello! (from the helloWorld object)  
IDL> OBJ_DESTROY, oJHello  

Example Code
This example code is also provided in the helloJava.java and hellojava2.pro files, which are in the resource/bridges/import/java/examples directory of the IDL distribution.

 


Note
Due to restrictions in IDL concerning receiving standard output from non-main threads, the bridge will only send System.out and System.err information to IDL from the main thread. Other threads' output will be ignored.

 


Note
A print() in Java will not have a carriage return at the end of the line (as opposed to println(), which does). However, when outputting to Java both print() and println() will print to IDL followed by a carriage return. You can change this result by having the Java-side application buffer its data up into the lines you wish to see on the IDL-side.

  IDL Online Help (March 06, 2007)