1

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 (i.e. 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.

Samdani
  • 11
  • 4

1 Answers1

0

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
Andy Guibert
  • 41,446
  • 8
  • 38
  • 61
  • this method will kill all the cmd.exe*32 running. but my concern is other. – Samdani Jul 23 '15 at 18:47
  • 1
    i want to kill only those cmd which has been created by current program. Let say i run 2 program A and B both has generated cmd and i want to kill cmd of A by the program of A and cmd of B by B program (i.e by it's own program) – Samdani Jul 23 '15 at 18:58