Java process control is notoriously bad - primarily due to inadequate support by the Java VM/JDK classes (e.g. java.lang.Process).
I am wondering, are there any good open source libraries out there that are reliable.
The requirements would be:
You can call destroy() method on it.
If the application appears to be hung and the process appears to be idle, then the first step is to try to get a thread dump. If the application console is available, then press Control+\ (on Oracle Solaris or Linux), or Control+Break (on Windows) to cause the HotSpot VM to print a thread dump.
Process process = new ProcessBuilder("processname"). start();
The Process is an abstract class defined in the java. lang package that encapsulates the runtime information of a program in execution. The exec method invoked by the Runtime instance returns a reference to this class instance. There is an another way to create an instance of this class, through the ProcessBuilder.
How about Apache Commons Exec?
Java Service Wrapper might be what you're looking for. It's cross-platform, can be used to start things as a Windows service, capture IO, and generally completely manage any java app. It's very light weight and well designed. Atlassian uses it to wrap their products (Jira, Bamboo, etc), so it's battle tested.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With