macos在OS X上启动终端,并使用Java运行命令
我正在开发一个JavaFX应用程序,我不知道如何在iOS上启动的终端上编写ssh命令
try {
Process process = Runtime.getRuntime().exec("/usr/bin/open -a /Applications/Utilities/Terminal.app /bin/bash");
int launched = process.waitFor();
BufferedWriter terminal = new BufferedWriter(new OutputStreamWriter(process.getOutputStream()));
System.out.println(launched);
terminal.write("/usr/bin/ssh -o CheckHostIP=no -o TCPKeepAlive=yes -o StrictHostKeyChecking=no -o ServerAliveInterval=120 -o ServerAliveCountMax=100 -i ~/.aws/.ec2/dublin.pem ubuntu@"
+ selectedRow.get(publicDnsNameIndex).getValue() + "\n");
} catch (Exception e) {
e.printStackTrace();
}
launched
始终为0,因此我无法再写入进程
共 (0) 个答案