Link to home
Start Free TrialLog in
Avatar of _D_
_D_

asked on

weird Runtime.exec() problem

I need to run a command, basically:

Runtime rt = Runtime.getRuntime();

command = "dostuff -a blah -d \"blah blah\"";

Process p = rt.exec(command);
p.waitFor();

the second argument is the problem, for some reason the application treats the quoted argument as two separate ones and comlains that 'blah"' does not start with a '-'

if I echo this exact command and then copy and paste it from the shell, it works fine

any suggestions?
ASKER CERTIFIED SOLUTION
Avatar of Jim Cakalic
Jim Cakalic
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of _D_
_D_

ASKER

yep, already figured it out and did this - well answered anyway