Java tutorial
import java.util.Map; public class Main { 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); System.out.println(env.get("SystemDrive")); } }