How do I get the id of my Java process?
I know there are several platform-dependent hacks, but I would prefer a more generic solution.
You can try getpid() in JNR-Posix.
getpid()
It has a Windows POSIX wrapper that calls getpid() off of libc.