I know that I am a necropolis, but I am answering the @Anarelle question to the currently accepted answer about stopping when there is no variable. This also answers the original question. In the Eclipse conditional interrupt window (in Debug Perspective), you can click on the checkbox next to Number of hits: and just give it several times so that the breakpoint is touched before it pauses execution. Please note that this not only works outside of loops (for example, debugging a pause only after I tried this action 3 times), but also takes into account external loops. For example, in the following code i will be 6 and j 3 when hitting a breakpoint, if the number of hits is 20:
for (int i = 0; i < 100; i++) { System.out.println(i); for (int j = 2; j < 5; j++) { System.out.println(j); } }
After the breakpoint has been deleted, it will be disabled until the user restarts it. In other words, this function can also be used to check every 20 times when a particular breakpoint is hit, if it switches on again every time.
source share