0

我正在尝试开发一个 GUI 应用程序,用于在Amazon Elastic Compute 2中创建和删除弹性Starcluster集群。到目前为止,我已经设法从图形应用程序创建和使用这些集群,但是当我尝试删除集群时遇到了问题。以下是我用来将命令插入控制台的方法(来自我的应用程序):

Runtime rt = Runtime.getRuntimne();    
Process proc = rt.exec("command",null,dir);

问题是系统要求我使用我的应用程序中使用的方法进行是/否确认,我无法通过该确认。到目前为止,我尝试了以下方法:

Runtime rt = Runtime.getRuntimne();    
Process proc = rt.exec("y",null,dir); //y for yes

但是系统一直在等待答案,忽略了应用程序中引入的命令。以下是请求确认的实际应用程序的日志:

ubuntu@ip-xxx-xxx-xxx-xxx:~$ starcluster terminate myCluster
StarCluster - (http://star.mit.edu/cluster) (v. 0.95.5)
Software Tools for Academics and Researchers (STAR)
Please submit bug reports to starcluster@mit.edu

Terminate EBS cluster myCluster(y/n)?

我将不胜感激有关此事的任何想法或想法。如果您认为有必要给出适当的答案,请随时询问更多信息。

4

1 回答 1

1

您需要将“y”写入流程标准输入流。

检查 Berry Tsakala 对该问题的回答:java: how to read and write to & from process thru pipe (stdin/stdout)

于 2014-06-13T15:36:01.503 回答