sourabhjha
Programmer
Hi ,
I am having strange issue while using the rsh command to invoke remote commnad on a unix host from a java pgm.
the code is simple.
Runtime runtime = Runtime.getRuntime();
Process p = runtime.exec(remoteCommandString);
Now here the string "remoteCommandString" is formed while reading some properties file.
Before running the command using runtime.exec() i am even displaying the whole string to make sure there are no syntax errors.
here is what it displays before getting executed
rsh gpseai01.corporate.ge.com -l jhaso "/home/getdata.sh"
I get some error like this
ksh: /home/getdata.sh : not found
However in the code if i just form the remoteCommandString by hardcoding the full command like this
String remoteCommandString= "rsh gpseai01.corporate.ge.com -l jhaso" +" \""+ "/homegetdata.sh"+"\"";
It goes just fine and i get the proper result.
I was wondering what diff it makes causing the command to fail in first case.
Please let me know if anyone has any ideas.
Thanks,
-Sourabh
I am having strange issue while using the rsh command to invoke remote commnad on a unix host from a java pgm.
the code is simple.
Runtime runtime = Runtime.getRuntime();
Process p = runtime.exec(remoteCommandString);
Now here the string "remoteCommandString" is formed while reading some properties file.
Before running the command using runtime.exec() i am even displaying the whole string to make sure there are no syntax errors.
here is what it displays before getting executed
rsh gpseai01.corporate.ge.com -l jhaso "/home/getdata.sh"
I get some error like this
ksh: /home/getdata.sh : not found
However in the code if i just form the remoteCommandString by hardcoding the full command like this
String remoteCommandString= "rsh gpseai01.corporate.ge.com -l jhaso" +" \""+ "/homegetdata.sh"+"\"";
It goes just fine and i get the proper result.
I was wondering what diff it makes causing the command to fail in first case.
Please let me know if anyone has any ideas.
Thanks,
-Sourabh