Newsletter sign-up
View all newsletters

Enterprise Java Newsletter
Stay up to date on the latest tutorials and Java community news posted on JavaWorld

JavaWorld Daily Brew

Runtime.exec is not working


Hi,

I have written a small java code to work with Runtime.exec(). I have an Expect file to which I am passing IP,User ID, Password to login to a remote machine and execute a script there. But seems its not working.
Code:
import java.io.*;
public class dload
{
public static void main(String arg[])
{
Process p = null;
Runtime rt;
String cmdLine="cmd /c chdir /d C: & cd ComverseAutomation\\Tools\\Expect & expect callingmulticalls.exp 10.210.156.61 sguuser sguuser";
try
{
rt = Runtime.getRuntime();
p=rt.exec(cmdLine);
}
catch(Exception e)
{
System.out.println(e);
}
}
}

Please help me how can i run this program. Thanks in advance.