I'm trying to execute an external command from java code, but there's a difference I've noticed between Runtime.getRuntime().exec(...) and new ProcessBuilder(...).start().
When using Runtime:
Process p = Runtime.getRuntime().exec(installation_path + 
                                       uninstall_path + 
                                       uninstall_command + 
                                       uninstall_arguments);
p.waitFor();
the exitValue is 0 and the command is terminated ok.
However, with ProcessBuilder:
Process p = (new ProcessBuilder(installation_path +    
                                 uninstall_path +
                                 uninstall_command,
                                 uninstall_arguments)).start();
p.waitFor();
the exit value is 1001 and the command terminates in the middle, although waitFor returns.
What should I do to fix the problem with ProcessBuilder?
 
     
     
     
     
    