Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

execute external command / application from java

I'm looking for a package to support reliably executing external processes from Java. My criteria:

  • Abstract over OS. So if I want to run 'foo', it will look for 'foo.bat', 'foo.exe' under windows and 'foo' under other OSs (or, have a way of passing a map of os->command)
  • Being able to execute Java classes by simply giving the class name and arguments (so the package locates the java command, copies jvm flags and then executes)
  • Process stdout and stderr properly
  • Watchdog / Monitoring capabilities

I've looked at commons-exec but it looks like it answers only 3 & 4. Ant has support for execution but looks like an overkill to use it for this purpose only.

like image 768
IttayD Avatar asked Mar 22 '26 16:03

IttayD


1 Answers

You will likely have to go with 'commons-exec' and then roll up your sleeves and write some code.

Those are pretty specific requirements.

like image 135
Timothy Avatar answered Mar 24 '26 07:03

Timothy



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!