Start, stop and listen to a process in Java
问题 I want to start a process with Runtime.exec() . Then I want to know (listen) when the process exits. Also, I want to manually stop the process if some condition met. The code I have now is: public class ProcessManager extends Thread{ private static ProcessManager manager; Process process; private ProcessManager(){ } public static ProcessManager getInstance(){ if(manager==null){ manager=new ProcessManager(); } return manager; } public void run(){ Runtime runtime = Runtime.getRuntime(); process