remove System.Exit from java code