0
我是mac os的新手。我在java中使用了下面的代碼來獲取系統細節。它打開一個終端來顯示該命令的結果。我需要在文件中獲得這些細節。我怎麼才能得到它。將mac os終端的內容寫入java中的一個文件
String[] command = {"/usr/bin/open", "/Applications/Utilities/System Profiler.app"};
Process proc = Runtime.getRuntime().exec(command);
int resultCode = proc.waitFor();
if (resultCode != 0) {
throw new Exception("failed to open system profiler");
}