我在 Maven 中有一个控制台 Java 应用程序,无限循环
我在java中处理异常
public class MyClassName {
public static void main(String[] args) {
while (true) {
start();
}
}
private static void start() {
try {
//this method check new files in S3 and copy to network location also it has throws Throwable
//i have not added code here because it is too long
doProcess()
} catch (Throwable t) {
t.printStackTrace();
}
}
}
doProcess() 方法检查 S3 中的新文件并复制到网络机器,它也抛出 Throwable
创建 jar 后,在 windows 命令提示符中
java -jar -Xmx8192M jarname.jar
当它抛出异常时,完全暂停直到ctrl+C,但如果我ctrl+C它将再次恢复,
这里有什么问题?java代码有什么问题还是命令有什么问题?