java.lang.ProcessBuilder.environment()


java.lang.ProcessBuilder.environment()

package com.codingdict;



import java.util.Map;



public class ProcessBuilderDemo {



   public static void main(String[] args) {



      // create a new list of arguments for our process

      String[] list = {"notepad.exe", "test.txt"};



      // create the process builder

      ProcessBuilder pb = new ProcessBuilder(list);



      // get the environment of the process

      Map<String, String> env = pb.environment();



      // get the system drive of the environment

      System.out.println("" + env.get("SystemDrive"));

   }

}