When communicating with programs that are running in another process, there are a number of options.
One option is to use sockets for interprocess communication. One program can act as the server program that listens on a socket connection for input from the client program. The client program connects to the server with a socket. Once the socket connection is established, either program can send or receive information.
Another option is to use stream files for communication between programs. To do this, use the System.in, System.out, and System.err classes.
A third option is to use the IBM® Toolbox for Java™ which provides data queues and iSeries™ message objects.
You can also call Java from other languages. See Example: Call Java from C and Example: Call Java from RPG for more information.