1.参数exepath 为EXE的位置,此处需要是绝对路径
2.json,id ,timestep是自定义的参数,可以不传,如果没有参数,只是单纯的运行EXE,将exepath以外的内容去掉即可
public String runExe(String json,String id,String timestep,String exepath) {
String[] cmd = { exePath, json,id,timestep};
Process process = null;
try {
Runtime runtime = Runtime.getRuntime();
process = runtime.exec(cmd);
process.waitFor();
} catch (Exception e) {
e.printStackTrace();
}finally {
if (process != null){
process.destroy();
}
}
return id;
}