When using ProcessBuilder, how do I set an environment variable in the subprocess?
Created Sep 12, 2005
John Zukowski Get the set of environment variables by getting a Map with the environment() method. Then, add variables with the put(key, value) method of Map.
ProcessBuilder processBuilder = new ProcessBuilder(
command, arg1, arg2);
Map<String, String> env = processBuilder.environment();
env.put("var1", "value");
env.remove("var3");