1

I am executing an external application using java process builder.

for eg

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

This application first retrieves the file out.log from the external host and then executes. Also, once the above command prompt is executed, it prompts for the host password.

How do I achieve this using java process builder? I tried to enter the command in the below mentioned way. However it throws an error that host is not found.

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

1 Answer 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.

Sign up to request clarification or add additional context in comments.

1 Comment

I tried to do this, however it does not seem to work. I am currently starting a new thread which reads the output generated by the external application. The java program just hangs.Is there any working example

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.