0

I have a Console Java Application in maven, infinite loop

I have handle exception in 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() method check new files in S3 and copy to Network Machine also it has throws Throwable

after creating jar, in windows command promp

java -jar -Xmx8192M jarname.jar

when it throws exception, pause completely until ctrl+C, but if I ctrl+C it will resume again,

what is wrong here? is there any wrong on java code or is there any wrong on command?

Bhesh Sejawal
  • 558
  • 2
  • 7
  • 22

0 Answers0