简体   繁体   中英

how to close currently created cmd.exe*32 and conhost.exe*32 using java code after execution of java program?

Actually i am running webobjects program through WOMonitor 5.4. If i execute program through WOMonitor then after instance up it creates two more exe (ie cmd.exe*32 and conhost.exe*32) that run in Task Manager as a process and it consumes more memory. For one instance it creates one cmd.exe*32 and conhost.exe*32 but on server i start 100 or 200 instance so create more cmd.exe*32 and conhost.exe*32. So please anybody help me.

Note: i want to see through java program that how many processes have been executed if i run a java program? If any method and java program any body has then please send me because this will help me.

You should be able do that with Runtime.exec(String command) by using the same type of commands that you would normally use to kill a process using Command Prompt.

Runtime.getRuntime().exec("taskkill cmd.exe*32");

If you want to check what processes are created, you could parse the command results of tasklist .

Program tasklist = Runtime.getRuntime().exec("tasklist");
InputStream programOutput = tasklist.getInputStream();
// parse programOutput in whatever way you want

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM