Shell output vs Process streams
- From: "Marcus Leon" <marcus.leon@xxxxxxxxx>
- Date: 27 Jul 2005 12:49:42 -0700
I'm trying to call a shell script from Java and read the script output.
Right now I get different text when I run the script from the command
line vs. when I run it from Java using the Process class. Does anyone
know why? Thanks.
Output From Command Line:
UID: readonly variable
ambiguous redirect
continue: only meaningful in a `for', `while', or `until' loop
Process.getErrorStream() Text:
/export/home/weblogic/fullexport.sh:
ORACLE_HOME=/u01/app/oracle/product/9.2.0: is not an identifier
Process.getInputStream() Text:
<blank>
My Java Program:
Process proc = Runtime.getRuntime().exec(args[0]) ;
BufferedReader br1 = new BufferedReader(new
InputStreamReader(proc.getErrorStream()));
while ((str = br1.readLine()) != null) {
error += (str + "\n");
}
BufferedReader br2 = new BufferedReader(new
InputStreamReader(proc.getInputStream()));
while ((str = br2.readLine()) != null) {
input += (str + "\n");
}
.
- Follow-Ups:
- Re: Shell output vs Process streams
- From: Gordon Beaton
- Re: Shell output vs Process streams
- Prev by Date: Re: Silly URL...
- Next by Date: Re: J2EE installation help
- Previous by thread: Silly URL...
- Next by thread: Re: Shell output vs Process streams
- Index(es):
Relevant Pages
|