2

I have a java application I made, I want to use third party tools which has .exe application which needs to be launched from command line with arguments, then it does the processing and gives output to command line.

I am wondering how do I go about launching this exe from my own java app in hidden/background mode and getting output from that third party app back as string or something?

arleitiss
  • 1,304
  • 1
  • 14
  • 38

2 Answers2

0

You can use Runtime.exec or a ProcesBuilder to launch an external application. To get the output or feed input into the application you can grab the InputStream and OutputStream of the Process object that is created. Some reading:

Executing another application from Java

http://www.javaworld.com/article/2071275/core-java/when-runtime-exec---won-t.html

Community
  • 1
  • 1
copeg
  • 8,290
  • 19
  • 28
0

you can use a process and process builder.

Proccess p = new ProcessBuilder("<PATH>", "param1", "param2", "param3");
p.start();

You can have multiple parameters.