I wrote a process manager program one of the things that it does is to exit all running processes when it shut down ,so there is the code
public void stop_all() throws IOException {
Process p = Runtime.getRuntime().exec("kill -9 -1");
System.out.println("killed");
}
and there is the action on the button
private void exitButton(java.awt.event.ActionEvent evt) {
Run ob = new Run();
try {
ob.stop_all();
} catch (IOException ex) {
Logger.getLogger(mainmenu.class.getName()).log(Level.SEVERE, null, ex);
}
this.dispose();
}
i have no idea why it doesn't work , i execute that command in the terminal and it works fine
please help :)