我正在尝试安装 apche tomcat。需要设置环境变量,如何设置环境变量?
我尝试使用ProcessBuilder
但它不起作用:
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();
}