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.
I know this is an old thread, but I wanted to call out that API for getting the PID (as well as other manipulation of the Java process at runtime) is being added to the Process class in JDK 9: http://openjdk.java.net/jeps/102