You can't catch an exception in an external process. Not with pure Java anyway. Maybe an individual O.S. may provide APIs for running programs with more control over error handling, but you'd have to access that with JNI.
If the program you are running is in fact a Java application, then you could gain more control by running it within the same JVM, instead of as an external process. Instead of invoking its executable, make its classes available to some or other ClassLoader, and invoke its main() method. You can try...catch around that invocation and hence catch any Java exception.
Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.
Joined: Jun 13, 2006
I suspected as much.
Thank you Peter!
subject: catching an exception thrown by a commandline app.