Java console app debugging in Xcode
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