Can you try/catch a stack overflow exception in java? It seems to be throwing itself either way. When my procedures overflows, I'd like to "penalize" that value.
Seems to work:
public class Test {
public static void main(String[] argv){
try{
main(null);
}
catch(StackOverflowError e){
System.err.println("ouch!");
}
}
}