1

我正在使用 java process builder 执行外部应用程序。

例如

./appl -file user@host:/tmp/out.log 

此应用程序首先out.log从外部主机检索文件,然后执行。此外,一旦执行上述命令提示符,它会提示输入主机密码。

如何使用 java process builder 实现这一目标?我尝试以下面提到的方式输入命令。但是它会引发找不到主机的错误。

List<String> command = new ArrayList<String>();
command.add("./appl");
command.add("-file");
command.add("user@host:/tmp/out.log");
4

1 回答 1

0

As you have explicitly mentioned: Also, once the above command prompt is executed, it prompts for the host password.

I believe the reason that the command is not being executed because the sub-process that you have triggered needs an input(host password),which you are not providing. Hence, you need to make an OutputStream to provide an input to your sub-process. For starters, read this question.

于 2012-06-13T12:10:29.767 回答