I am trying to install apche tomcat. There arises a need to set environment variable's , how can I set environment variable?
I tried using ProcessBuilder
but it doesn't work:
ProcessBuilder pb = new ProcessBuilder("CMD.exe", "/C", "SET"); // SET prints out the environment variables
pb.redirectErrorStream(true);
Map<String,String> env = pb.environment();
String path = env.get("CATALINA_HOME") + apachePath;
env.put("CATALINA_HOME", path);
Process process = null;
try {
process = pb.start();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}