I see. You might want to have a look at this article, which talks about the various ways Runtime.exec can cause trouble.
Joined: May 15, 2007
I did read about the limitations somewhere else. Is there any alternative to exec?(can a socket be used?)
Joined: Mar 22, 2005
Runtime.exec has its limitations, but as long as the target program communicates via tandard input/output it should work.
Other means of communication may be possible if the target program supports them (ports in particular won't generally be available).
Joined: Jan 29, 2003
Yes, this kind of thing can work. I once used a language called EASEL (now ESL) whose "database integration" was done via shelled programs and the input / output streams. This is not really EASEL, but conversations looked something like
This is a bit harder in Java. I'm reading stdout from the shell program here. If it writes a zillion lines to errout it will block waiting for somebody to read them. Multiple threads are involved for sure. If you have a conversational request-response model like this you might use Futures to get the response from stdout and errout.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi