Kindly let me know, how to get the ProcessId of the Currently running Process in java. I want to get the processId and need to stop that particular process. I am trying this by using <code>proc.destroy();</code> method in my application. but the problem is not solved. The process is running yet. Can any one let me know how to forcily destory or stop the currently running process. If possible kindly give me the code for this....
Process-based multitasking is not under the control of Java - the language is based on a threading model. Or perhaps by "process" you mean java.lang.Process? If so then the process has object identity, not an id.
But whatever your process is, it should have an exit code. Try checking that to see what it tells you.
Well, if you really want to kill the current process, System.exit() will work, but since there is only one process for your JVM, that will kill your entire Java enviroment.