There is no public API for this yet. see Sun Bug 4244896, Sun Bug 4250622
As a workaround:
Runtime.exec(...)
returns an Object of type
java.lang.Process
The Process class is abstract, and what you get back is some subclass of Process which is designed for your operating system. For example on Macs, it returns java.lang.UnixProcess
which has a private field called pid
. Using Reflection you can easily get the value of this field. This is admittedly a hack, but it might help. What do you need the PID
for anyway?