Get/set the working directory

ReturnMethodSummary
Filedirectory()Returns this process builder's working directory.
ProcessBuilderdirectory(File directory)Sets this process builder's working directory.

import java.io.File;
import java.util.Map;

public class Main{
  public static void main(String args[]) {

    try {
      ProcessBuilder pb = new ProcessBuilder("myCommand", "myArg1", "myArg2");
      pb.directory(new File("myDir"));
      Process p = pb.start();
    } catch (Exception e) {
      System.out.println("Error executing notepad.");
    }
  }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.