简体   繁体   中英

Exit code 1 while calling an external process using java Runtime exec

I'm using apache commons exec for creating an external java process, which returns an exit code 1 occasionally. When I looked into the code of commons exec the issues doesn't seem to be related to apache commons exec rather to do with Runtime exec on java.

Here, I'm running a multithreading program which creates these processes. And I have tested the code by passing an idfier to external process to identify if the process got created by failed during processing. But for those threads which are failing while invoking the exex command doesn't seems be invoking the external java process as I don't find the failed process idfier in the log.

Any suggestions on what could be the potential cause for this would be very much appreciated.

Commons exec just returns you the exit code of the external process whenit's finished. Usually exit code 1 means "exited with some error". The exact meaning of the code will vary for each application. If you are lucky, the exit codes of your external java process have been defined in it's API or other documentation so you can look it up. If not, try to find the source code or contact the makers of the code.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM