用java执行时,mc 文件不存在:
Process process =Runtime.getRuntime().exec(cmd);
log.info("执行命令cmd: {}",cmd);
执行命令之前,增加 sh -c 2个参数就行了:
//获取进程
String[]cmdArr =new String[]{"sh","-c",cmd};
Process process =Runtime.getRuntime().exec(cmdArr);
log.info("执行命令cmd: {}",cmd);