I’m curious if there’s a keyword in Java which would allow eclipse or an IDE to stop running through code and start the debugger when the code reaches a particular point.
I understand that breakpoints are very useful for this particular problem, however I wish to only begin to debug the program if a particular condition is reached, and this condition is one which is not checked by the program regularly, so I’d have to program it in purely for debugging.
For example,
if(condition_is_met){
//throw debugger and begin to step through here
}
The only other way I can think of doing it is…
if(condition_is_met){
System.out.println("Something"); //Then set a breakpoint here in Eclipse.
}
Which just seems messy, and means I would be liable to miss it when cleaning up the code later. Does Java have a keyword for this, perhaps similar to Javascript’s debugger keyword?
There is no keyword for it but you can specify conditional debugging in Eclipse.
Check below