File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes IDEs, Version Control and other tools and the fly likes debug - breakpoint -- only stop when a variable is a certain value? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "debug - breakpoint -- only stop when a variable is a certain value?" Watch "debug - breakpoint -- only stop when a variable is a certain value?" New topic
Author

debug - breakpoint -- only stop when a variable is a certain value?

Ben David
Ranch Hand

Joined: Oct 01, 2010
Posts: 67

I want to debug a program that runs through a lot of loops within loops. I want to set a break point, but the iteration I want to look at is hundreds of iterations in.

Is there a way to set a conditional breakpoint? So that it will only stop at the breakpoint when a variable I specify has a value that I specify?

Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36514
    
  16
What about a conditional print?
Ernesto Chicas
Greenhorn

Joined: Jan 13, 2010
Posts: 18

maybe this helps

FAQ How do I set a conditional breakpoint?

netbeans has something like this
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24166
    
  30

Hi Ben,

As you can see, the answer to 'can I' is "yes" -- but the answer to 'how can I' depends entirely on what debugger (i.e., what development tools) you're using, which you neglected to mention. Let us know and somebody can probably tell you exactly what to do.


[Jess in Action][AskingGoodQuestions]
Ben David
Ranch Hand

Joined: Oct 01, 2010
Posts: 67
Ernest Friedman-Hill wrote:Hi Ben,

As you can see, the answer to 'can I' is "yes" -- but the answer to 'how can I' depends entirely on what debugger (i.e., what development tools) you're using, which you neglected to mention. Let us know and somebody can probably tell you exactly what to do.


oops!! -- my bad!! I was totally meant to say I was using netbeans, but failed to get that into the post!

Anyway Ernesto Chicas comment helped me out. Dont know why i didnt try right clicking the breakpoint after setting it. I can then click "properties" and have a box where I can set the condition.


Thanks all!


Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36514
    
  16
This sounds like a NetBeans-related question which would sit better on our IDEs forum. Moving.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: debug - breakpoint -- only stop when a variable is a certain value?
 
Similar Threads
debug issue...how to see the value of a variable while debugging
Run a Program until specified line
debug issue...how to see the value of a variable while debugging
How to work with BreakPoints
debugging with ANT