Java: Die on error / detect frozen?
Posted on 2008-11-17
I'm still debugging a java application I wrote, that does a lot of work with databases. Occasionally, I get a java heap error or local memory error. Right now, it prints out the error message and the app just stops. It doesn't die, it just sits there with the printed out error message.
I'm running the application from a batch file:
java -jar myapp.jar
Is there a way to setup the java environment, or the app, so that on error like heap/memory, kill the app?
Best thing i to find the bug and squash it, but for resiliency, I'd like to be able to keep the app running after crash. If it exists, I can detect that and restart it (I think) by setting it up as a service in Windows.