I'm using the Apache Commons Exec jars for creating processes. However I'd like to get control of the process id of processes being invoked.
Is there a way of getting the 'Process' object from the Apache Commons Exec api? I did'nt fine any public methods that returns the 'Process class.
See http://commons.apache.org/exec/apidocs/index.html
Interface CommandLauncher contains several
exec
methods that returnProcess
.But anyway you do not have any way to control the process ID: it is the OS responsibility. Moreover standard java API does not allow you even to retrieve the process ID. There was a trick in older java versions: the implementation of Process contained int field pid that could be retrieved using reflection. But this was changed in version 1.6.