How to kill Firefox child process / tab from Java / C ++

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" );

+3
3

:

wmic process get description, executablepath, processid | findstr firefox

PID firefox. tskill PID, .

+1

.

.

- . , script (shell unix, bat Windows), , . kill -9 PID linux taskkill . ( 2).

. URL-, , ( , javascript), . URL- AJAX- . , , , . javascript, , . - .

. , , AJAX, . , AJAX, . , , , AJAX . 100% , .

0

pkill (killing by process).

Runtime.getRuntime().exec("pkill firefox");

++

system("pkill firefox");

. Unix- , .

0

All Articles