Ignore System.exit() from other class

前端 未结 1 423
闹比i
闹比i 2021-01-12 03:45

Given the class below,

public class ClassOne {
    public static void main(String... args) {
        System.exit(1);
    }
}

The following

1条回答
  •  孤街浪徒
    2021-01-12 04:17

    You can't ignore it per se, but you can prevent it from terminating the JVM via SecurityManager. Take a look at this question for detailed code example.

    0 讨论(0)
提交回复
热议问题