M
Marcus Leon
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");
}
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");
}