Return to the RPG Tips
Passing Parameters to JAVA from RPG
Using the RUNJVA (Run Java) command in a CL program, you can pass parameters to a Java class. These parameters end up as the array of string arguments to a Java class's main method. Note, however, that these parameters are input only; a Java class won't be able to return values to a CL program. To execute a Java class with a CL program and pass parameters in both directions, look to IBM's AS/400 Toolbox for Java. Using the Toolbox, you can use AS/400 data area or data queue objects as a means to accommodate a bi-directional exchange of data.
You may be interested to learn that, using the AS/400 Toolbox for Java's program call facility, a Java class can directly call an RPG or CL program, exchange data with the program, and pass data as input, output, and input/output parameters. For more on the toolbox, see http://www-1.ibm.com/servers/eserver/iseries/toolbox/.
[report a broken link by clicking here]