• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Java console app debugging in Xcode
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Java console app debugging in Xcode


  • Subject: Java console app debugging in Xcode
  • From: "Bradley Farnsworth" <email@hidden>
  • Date: Sat, 15 Apr 2006 11:58:29 -0400

Hello Xcode Developers!

I am writing some software in Java using Xcode that has a command-line
(terminal window) interface.  It's working great, except when I go to
debug it, I can't determine how to input text to the console.

The Debugger Console shows all the program's output while I am using
the debugger interface.  However, when the program goes to fetch input
from the command line, say, with a command like:

n = input.nextInt();

then the debugger console goes to the JavaBug> prompt which doesn't
allow me to enter data to my program.  I tried entering my data in the
Standard I/O window, but it doesn't seem to take.  Maybe this method
only works using the gdb debugger?

Apple's documentation has this to say about the subject:
-----
Debugging a Command-Line Program

If you are debugging a command-line program that requires input from
stdin, you must use the Standard I/O Log to communicate with your
program when it is running in the debugger. To open the Standard I/O
Log window, choose Debug > Standard I/O Log. This window is only
available when your program is running under the debugger.
-----

Any insights on this?  I've included some sample code below.

Best regards,
Bradley D. Farnsworth

--------------------

import java.util.Scanner;

public class ConsoleExample
{

   public static void main (String args[])
       {
               //set up Scanner
               Scanner input = new Scanner( System.in );

               int n;

               //get the value of n
               System.out.print("Please enter the value of 'n': ");
               n = input.nextInt();

               System.out.printf("You entered %d!", n);
       }
}
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Java console app debugging in Xcode
      • From: "Andrea \"XFox\" Govoni" <email@hidden>
  • Prev by Date: Re: Use of "/" in Build Configuration Names?
  • Next by Date: Dead code stripping
  • Previous by thread: Re: Use of "/" in Build Configuration Names?
  • Next by thread: Re: Java console app debugging in Xcode
  • Index(es):
    • Date
    • Thread