Java 코드에서 외부 명령을 실행하려고하는데 Runtime.getRuntime().exec(...)와 사이에 차이점이 new ProcessBuilder(...).start()있습니다.
사용시 Runtime:
Process p = Runtime.getRuntime().exec(installation_path +
uninstall_path +
uninstall_command +
uninstall_arguments);
p.waitFor();
exitValue는 0이고 명령은 정상적으로 종료됩니다.
그러나 ProcessBuilder:
Process p = (new ProcessBuilder(installation_path +
uninstall_path +
uninstall_command,
uninstall_arguments)).start();
p.waitFor();
종료 값은 1001이고 명령 waitFor은 반환 되지만 중간에서 종료됩니다 .
문제를 해결하려면 어떻게해야 ProcessBuilder합니까?