I'm new to the NetBeans IDE (5.5) and am trying to get some Java code I've written to run in it. The program has three classes (one with a main method), and it all compiles and runs fine using javac and java from a DOS system prompt. In the IDE it doesn't run properly. I've spent a frustrating amount of time looking at the IDE documention, searching the web, etc. without success.
I've used MS Visual Studio for several years and seek the ability to step through the code and watch how variables change, etc. I'm trying to move from VB to Java. I think I have the packages and classes in the IDE correctly, and I get messages saying that the project builds successfully. I don't understand why a program would run in a DOS window but not in a simple IDE output window.
The problem comes about when the program asks for user input. I see that there is a small Input window below the Output window in the IDE. The program pauses for input before displaying the prompt which is BEFORE the input statements in the code, e.g.:
...
System.out.print("Enter a number");
try {
BufferedReader is = new BufferedReader(new InputStreamReader System.in));
inputLine = is.readLine();
if (inputLine.length() == 0 ) return null;
} catch (IOException e) {
System.out.println("IOException: " + e);
}
return inputLine;
...
I can step right over the System.out.print line without anything displaying in the Output window. Then if I enter a number in the Input window and press Enter, "Enter a number" appears in the Output window and the program continues to run.
What could be different about running this from the NetBeans IDE? I know many people suggest not using IDEs especially in the learning phase of a language, but want to be able to use at least the most basic NetBeans features so I can step through my programs to debug them...
This is my first post here. Any guidance would be much appreciated.
Thanks,
sirrom

New Topic/Question
Reply




MultiQuote



|