How to Stop a Running a Program Using Other Java Program
I have been implementing a program to compile and run other applications. I was wondering if there is a way to terminate a program when my application discovers that there is an issue e.g. infinite loop. I tried to using process.Destroy() but it kills the CMD not that actual program that has infinite loop... Your help is really appreciated. Here is a part of my code: synchronized (pro) { pro.wait(30000); } try{ pro.exitValue(); }catch (IllegalThreadStateException ex) { pro.destroy(); timeLimitExceededflag = true; System.out.println("NOT FINISHED123"); System.exit(0); } } Basically I am making