我正在尝试开发一个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 [email protected]
Terminate EBS cluster myCluster(y/n)?
我对此事有任何想法或想法。如果您认为有必要给出适当的答案,请随时询问更多信息。
您需要在流程stdin流中写入“ y”。
检查对这个问题给出的Berry Tsakala的答案:java:如何通过管道(stdin / stdout)读写进程
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句