有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

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,因此我无法再写入进程

完整的代码在这里https://github.com/gadelkareem/aws-client/blob/dev/src/main/java/com/gadelkareem/awsclient/application/Controller.java


共 (0) 个答案