I have a shell script that contains the following command
rsh <ip of machine> free > abc.txt
This shell script I am running from Linux and it works fine. However if I am running this from a java program on the same box it is not working. This is the code I am using
try
{
Runtime runtime = Runtime.getRuntime();
Process P= null;
String path = "<PATH WHERE THE SHELL SCRIPT RESIDES>"
P = runtime.exec(path);
int wait = P.waitFor();
}
catch(Exception e)
{
}
Start Free Trial