Possible Duplicate:
What’s the difference between a System property and environment variable
What is the difference between System.getenv() & System.getProperty()?
When we run any command using Processbuilder, we can set the environment variables ie:
String[] vCmd = { System.getenv("ANT_HOME") + "/bin/ant", "-f",
ANT_BUILD_FILE, TARGET };
ProcessBuilder pb = new ProcessBuilder(vCmd);
Map<String, String> env = pb.environment();
env.put("CLASSPATH",
antHome+"/lib/ant.jar:"
+ antHome+"/lib/ant-launcher.jar:"
+ antHome+"/lib/ant-nodeps.jar:"
);
try{
Process process = pb.start();
InputStream is = process.getInputStream();
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
String line;
while ((line = br.readLine()) != null) {
System.out.println(line);
}
pb.wait();
}
catch(Exception e)
System.out.println(e.getMessage());
}
If I set some properties using System.setProperties() before this method , is it available to this process started by ProcessBuilder?