How do I change the starting directory for running a command with ProcessBuilder?

John Zukowski

Use the directory() method of ProcessBuilder to change the starting / working directory. Once setting the directory, start() the sub-process.

   ProcessBuilder processBuilder = new ProcessBuilder(
                                       command, arg1, arg2);
   Process p = processBuilder.start();
0 Comments  (click to add your comment)
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.