While Loop Confounds JDK's Command Line Debugger (jdb)
My code includes this line:
Code Java:
while(input.hasNext())
{
int variable = input.nextInt();
...
}
When I step through the code, jdb stops at the beginning of the while loop and I can't find a way to get past it.
How does one debug code requiring a user input with the command line debugger?
Re: While Loop Confounds JDK's Command Line Debugger (jdb)
which debugger are you using?
Re: While Loop Confounds JDK's Command Line Debugger (jdb)
Use remote debugging with 2 consoles - one for the app and another for the jdb. The following link might be of some use for how to do this via a command line app:
debugging - How do I pass console input to a running Java program instead of to jdb? - Stack Overflow
Re: While Loop Confounds JDK's Command Line Debugger (jdb)
Quote:
Originally Posted by
jps
which debugger are you using?
I am using the debugger provided by the Java Development Kit.
It opens upon typing jdb in the command line.
Re: While Loop Confounds JDK's Command Line Debugger (jdb)
Thanks. This is interesting. I will do some experiments and get back to you.