Runtime.getRuntime().exec ???

From: Andrew Regan (andrew.m.regan_at_hp.com)
Date: 06/28/04


Date: Mon, 28 Jun 2004 18:20:42 GMT

I'm using Process runner = Runtime.getRuntime().exec( cmdArgs );
where cmdArgs {"/bin/sh", "-c", <perl program>}.

If <perl program> is "/opt/vr/bin/show_active_servers" I can get the input
stream and read what the perl program outputs as follows. In fact it works
for any of the 4 programs in /opt/vr/bin directory.

BufferedReader is = new BufferedReader(new
InputStreamReader(runner.getInputStream()));
while((line = is.readLine()) != null){
    System.out.println(line);
}

However if I change the program to "/opt/vr/etc/vr_report" I can't read any
of the programs output. No exceptions are thrown. The exit level of the
process is 0. I have tried inserting waitFors(). The perl programs are all
chmoded the same and are owned by the same user. I have also tried reading
from stderror and can't get any of the programs output. I have timed the
programs and the times seem to indicate that the java program is executing
the perl program, but I can't read any of its output?

Any ideas?

Thanks for your help,
Andrew Regan



Relevant Pages

  • Runtime.getRuntime().exec() ??
    ... I'm using Process runner = Runtime.getRuntime.exec; ... stream and read what the perl program outputs as follows. ... from stderror and can't get any of the programs output. ...
    (comp.lang.java.programmer)
  • Re: Runtime.getRuntime().exec() ??
    ... > stream and read what the perl program outputs as follows. ... > BufferedReader is = new BufferedReader(new ... > from stderror and can't get any of the programs output. ...
    (comp.lang.java.programmer)
  • Re: Runtime.getRuntime().exec() ??
    ... Andrew Regan wrote: ... > stream and read what the perl program outputs as follows. ... > from stderror and can't get any of the programs output. ...
    (comp.lang.java.programmer)