Debugging java for loop: skip to a specific iteration
debugging, for-loop, java, netbeans
Solution
You could use something like the Java Platform Debugger Architecture. That might help. On the other hand, you could do something like so:
for (int i = 0; i < ...; i++)
{
if (i == 28)
{
System.out.println("Line Found"); //put breakpoint here
}
//remainder of the code.
}
This should allow you to trigger a breakpoint on the 29th execution of the loop and you can then use the step functions offered by the debugger to go over the code for the 29th iteration.
I have never used the JPDA, and even if I did I think that the most simple and straight forward solution would be to do something like the code above.
Problem
I'm working on a java project in Netbeans. I have a for loop which runs 29 times and each iteration takes about 1 minute to complete. The problem is in the 29th iteration of the loop. Is there any way that I can SKIP the first 28 iterations and go directly to the one in question? I know I can put a conditional breakpoint, but that dosent make the debugger skip the iterations, it just notifies me when a paticular iteration is reached. Please Help! Otherwise, this would take a awful lot of time to debug!