Eclipse Tip: Change variable values while debugging

When you are debugging, some times, you would want to change the value of a variable. For example a variable is null and you know you are going to encounter the dreaded NullPointerException. If you could just set the correct value to it you can proceed with the debugging and worry about the null check later.

Well Eclipse to the rescue. Just right click on the variable in question and choose Assign Value. You get a popup dialog where you can set the value. Now you can continue debugging happily.

Vasanth Dharmaraj is a Java Architect currently working for Western Union living in the Bay Area. He is interested in programming, gadgets, formula one... You can follow him on Twitter.

Posted in Eclipse, Java

Ads By Google