I need a way to communicate with an external tool which has a Command Line Interface from my Java application. Is there any handy tool/lib to make it less painful? Believe me, I've googled enough. Thank you!
You can use Runtime.exec() for executing external commands of the operating system. Be aware, though, of the gotchas of using it - make sure to read this article first.
If that's too simplistic for your needs, take a look at ProcessBuilder. It's available since Java 1.5, from the release notes:
The new ProcessBuilder class provides a more convenient way to invoke subprocesses than does Runtime.exec. In particular, ProcessBuilder makes it easy to start a subprocess with a modified process environment (that is, one based on the parent's process environment, but with a few changes).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With