Knowing which java.exe process to kill on a window

2020-01-27 00:18发布

When a java based application starts to misbehave on a windows machine, you want to be able to kill the process in the task manager if you can't quit the application normally. Most of the time, there's more than one java based application running on my machine. Is there a better way than just randomly killing java.exe processes in hope that you'll hit the correct application eventually?

EDIT: Thank you to all the people who pointed me to Sysinternal's Process Explorer - Exactly what I'm looking for!

标签: java windows
12条回答
Viruses.
2楼-- · 2020-01-27 01:12

If you can't run a GUI application like ProcessExplorer and you're looking for the "Command Line" arguments of the processes then you can use "wmic" via the command line. For example:

wmic PROCESS get Processid,Caption,Commandline

If you want to look for a specific process you can do this:

wmic PROCESS where "name like '%java%'" get Processid,Caption,Commandline

The output from this will show you all of the command line arguments of processes like "java."

查看更多
Root(大扎)
3楼-- · 2020-01-27 01:14

Have you tried using Process Explorer from SysInternals? It gives a much better idea of what is running within the process. Available free online here: http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx

查看更多
叛逆
4楼-- · 2020-01-27 01:14

I'd suggest downloading Process Explorer from Sysinternals and looking at the different java.exe processes more closesly, that way you can get a better idea of which one to kill.

http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx

It's very intuitive and you can find the java.exe processes and right click and goto their properties, from there you can see their command line, time of creation, etc which can help you find the process you want to kill.

Hope it helps.

查看更多
该账号已被封号
5楼-- · 2020-01-27 01:18

Rather than using a third party tool, you can also make a pretty good guess by looking at all the columns in task manager if you know roughly what the various java processes on your system are. From the Processes tab, use View-> Select Columns and add PID, CPU Time, VM Size, and Thread count. Knowing roughly what the process is doing should help narrow it down.

For example, in a client-server app, the server will likely use more memory, have more threads, and have used more CPU time because it has been running longer. If you're killing a process because it's stuck, it might simply be using more CPU right now.

MAX java heap memory is usually directly reflected in VM Size. So if you're using -Xmx flags, the process with the larger setting will have a larger VM Size.

查看更多
爷、活的狠高调
6楼-- · 2020-01-27 01:19

If you're using Java 6, try jvisualvm from the JDK bin directory.

查看更多
爷、活的狠高调
7楼-- · 2020-01-27 01:20

In case you're developing software: use a java-launcher. I used for a few of my application [Exe4j][http://www.ej-technologies.com/products/exe4j/overview.html] and it worked very well. When the application is started, it's listed as for example "myserverapp.exe" or "myapp" in the windows tasks manager. There are other lauchers too (don't known them by heart), few of them might be for free too.

查看更多
登录 后发表回答