I have a Java application that calls the browser [IE or Firefox, etc.].
The requirement is when my Java application logs out, I have to kill all the web pages [child processes] that I opened from my application in IE / Firefox, etc.
I am using the following code.
Note. cmd contains "The source path and system browser URL"
static ArrayList<Process> pro = new ArrayList<Process>();
String cmd=" ";
Process p = Runtime.getRuntime().exec(cmd);
pro.add(p);
I support static arraylist to add all process objects.
To kill the called process, I use the code below
Iterator<Process> iter = pro.iterator();
while(iter.hasNext()){
Process p = iter.next();
System.out.println("Now Killing "+p.toString());
p.destroy();
}
This code is [ p.destroy (); ] works fine for Internet Explorer, but it doesn't work for Firefox / Chrome ...
Firefox , , , : (...
Windows Linux.
++, . ,
Runtime.getRuntime(). exec ( " cmd" );