Java - New Jar & Fixed infinite loop until memory limit exceeded