Problem with ProcessBuilder in java
Hi All,
I am trying to invoke a command line script from java using ProcessBuilder. Here is how my code looks like.
ProcessBuilder pb = new ProcessBuilder(commandToRun.trim());
pb.directory(new File(fromproddir));
p = pb.start();
But it is not executing the command and fails with the exception"CreateProcess error=123, The filename, directory name, or volume label syntax is incorrect". However, this same command runs perfectly from commandline. It also works from Runtime.exec as given below.
p=Runtime.getRuntime().exec(commandToRun, null,new File(fromproddir));
Any one has any idea when processbuilder throws this error.
PS: commandToRun invokes 7za script to zip a directory.
Thanks,
Lakshmi
|