I have a method called taskkill() written in java. I want to implement the cmd command taskkill in the selected field (as shown). I don't know how to apply this command in java. Please help.
public static Timer taskkill() {
TimerTask timerTask = new TimerTask() {
@Override
public void run() {
// TO APPLY CMD COMMAND [ TASKKILL /F /FI "WINDOWTITLE ne File1" /FI "WINDOWTITLE ne File2" ]
}
};
Timer timer = new Timer("MyTimer"); //create a new Timer
timer.scheduleAtFixedRate(timerTask, 30, 10000); //this line starts the timer at the same time its executed
return timer;