From your question, I assume you have 2
separate programs (1 java and 1 c++) and have
the source code for these programs. I also
assume that each of these programs reads stdin
for it's data and writes data to stdout.
I also assume that these programs have no
relationship to each other meaning that one
program does not start the other as a child.
If you want to use pipes, you may want to
consider FIFO devices (sometimes referred to
as a "named" pipe). You can create FIFO's
using the "mknode" command. If you want you
programs to utilize stdin and stdout, for example:
myjavaprog < /dev/myfifo1 > /dev/myfifo2 &
myc++prog < /dev/myfifo2 > /dev/myfifo1
then your code should first close all open
file descriptors and open /dev/myfifo1 and
/dev/myfifo2 for reading or writing as
appropriate. Also, you should open a file
for error output as well. Once you've done this,
the programs should work as if stdin and stdout
have been redirected. The main caveat here is that
you can expierence deadlock if your programs
block on reading or writing as reading and empty
pipe will wait forever and writing a full pipe
will block forever unless you set up your
connections as non-blocking. There are actually
a number of ways to deal with this but it does
require some forthought.
I hope this helps a bit.