Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Related question:

We have something like this

private int myFunction(int i)

    //line a
    //line b
    //line c
    return v; 

private void myMain()
    for (int i = 0; i<10; i++)


Now something's going wrong in myFunction, let's say for when i = 6.

The way I see it, I have two options:

  • I can add a breakpoint at line a, run the debugger and step return till i=6, and look at the values at each line.
  • I can go in a put console/stdout statements at lines a, b, c, and get a complete listing/trace of how the variable that I'm interested in are changing.

The problem with this second solution, is that I'm then constantly pasting/typing in console statements and then going through an removing them.

What would be a lot easier, is being able to click in breakpoints, and then telling it, which variables I'm interested in, and have the debugger print out those variables, as well as the line number to a log.

Is this possible?

share|improve this question

You can add code to a breakpoint to decide when it becomes active.

Right click on the breakpoint and select Breakpoint Properties, select the Conditional check box and you will be able to type code - something like:

return i == 6;

to stop when i is 6.

More details in Java Debugging with Eclipse

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.