execute external command / application from java
Posted
by IttayD
on Stack Overflow
See other posts from Stack Overflow
or by IttayD
Published on 2010-03-16T12:57:20Z
Indexed on
2010/03/16
13:06 UTC
Read the original article
Hit count: 185
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.
© Stack Overflow or respective owner