Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 5 of 5

Thread: While Loop Confounds JDK's Command Line Debugger (jdb)

  1. #1
    Junior Member
    Join Date
    Aug 2012
    Location
    Ottawa, Canada
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default While Loop Confounds JDK's Command Line Debugger (jdb)

    My code includes this line:

    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?


  2. #2
    Super Moderator jps's Avatar
    Join Date
    Jul 2012
    Posts
    2,642
    My Mood
    Daring
    Thanks
    90
    Thanked 263 Times in 232 Posts

    Default Re: While Loop Confounds JDK's Command Line Debugger (jdb)

    which debugger are you using?

  3. #3
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,320
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default 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

  4. #4
    Junior Member
    Join Date
    Aug 2012
    Location
    Ottawa, Canada
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: While Loop Confounds JDK's Command Line Debugger (jdb)

    Quote Originally Posted by jps View Post
    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.

  5. #5
    Junior Member
    Join Date
    Aug 2012
    Location
    Ottawa, Canada
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: While Loop Confounds JDK's Command Line Debugger (jdb)

    Thanks. This is interesting. I will do some experiments and get back to you.

Similar Threads

  1. sdtin/command-line
    By TorontoJava1984 in forum File I/O & Other I/O Streams
    Replies: 1
    Last Post: October 16th, 2011, 01:51 PM
  2. Replies: 10
    Last Post: September 16th, 2011, 07:49 PM
  3. jre version in command line
    By major in forum What's Wrong With My Code?
    Replies: 2
    Last Post: June 14th, 2011, 06:55 AM
  4. command line arguments
    By rizla in forum Member Introductions
    Replies: 3
    Last Post: December 12th, 2010, 11:14 PM
  5. [SOLVED] Command Line Argument Help
    By EmSaint in forum Loops & Control Statements
    Replies: 2
    Last Post: January 28th, 2010, 10:55 AM