Kill only one Java process
I usually run few Java applications, one for server running locally and other for some IDE like NetBeans. And from time to time, after lots of redeployments, my server get stuck on OutOfMemoryException so I need to kill Java process in order to reboot.
So I do
pkill -9 javabut this also kills my running IDE which I don't want to. So how do I kill only application linked to running server and not the other ones?I assume that they all are running under same process but there has to be some way how to distuingish them.
look at your process table (via `top` or `ps`) and choose the right one and kill it by PID (kill -9 PID_number).
Oh yes, I can see that now. So I just need to kill process with right `PID`. Thanks a lot
For killing a process that is associated with multiple processes, you need to kill that by using process id associated with that process.
To get the process id of that java process run
ps -A |grep java
output of this command will give the list of java processes running on your system. Note down Process ID (PID) of that process whom you want to kill and run
kill -9 PID