How to catch OutOfMemoryError in JVM and run a script if it's caught?
问题 I have a program that sometimes throw OOME, I understand that there is a flag in the JVM options that I can set and whenever a certain Error/Exception appears (such as OOME) it calls a script I wrote. The script will give the user a notification and will call a the program with a different argument so it won't get OOME again. does anyone know how to set this flag? what is the JVM options I need to set? I looked everywhere on line and couldn't find the answer. help me please! Thanks, Aye 回答1: