I’m executing an external program which runs alongside Java using this:
Process p = Runtime.getRuntime().exec("/path/to/binary");
When I stop the Java application, the external program continues to run but I want this to stop too.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
To trigger the shutdown, you could add a shutdown hook to your Java application. See Runtime.addShutdownHook().
To effect the shutdown, you could either communicate to the external process a request to stop gracefully, or call Process.destroy()