0

hi,
i just wrote my first java program, it compiles and runs and all, but the console window closes too quickly u can hardly see the output.
how can i rectify that?

4
Contributors
6
Replies
7
Views
10 Years
Discussion Span
Last Post by Fungus1487
0

Not sure what the problem is, but you could try sending the output to a text file to view it in Notepad. Normally to run a java class file you would type something like

java myProgram

Try

java myProgram > output.txt

That will create a file, output.txt, that you can open and view the console output of your program.

0

first better way... is try to run programs in command prompt thats is the best way to start a learning step for java

install jdk 1.5 or latest 1.6

then set your class path

compile it

javac programname.java


and run

java programname

you will get the output in the command prompt console itself

0

use the following at the end of your code

BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
in.readLine();

it will pause your command prompt and wait for an input.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.