-Xss128k
The stack size specified is too small, Specify at least 160k
-Xss256k
private static int count; public static void count(){ try { count++; count(); } catch (Throwable e) { System.out.println("最大深度:"+count); e.printStackTrace(); } } public static void main(String[] args) { count(); }