Delphi Clinic C++Builder Gate Training & Consultancy Delphi Notes Weblog Dr.Bob's Webshop
Hubert Klein Ikkink (aka Mr.Haki) - Communications Officer
 Mr.Haki's JBuilder Jar #1
See Also: JBuilder Papers

Don't lose your output!
Suppose we have written an application or applet that displays output using the System.out or System.err output streams. When running this application or applet the output will be displayed in the started DOS box. But what if the output contains many lines, or is displayed too fast, so we can't read what is displayed in the DOS box?

Two different solutions can be used to solve this problem:

  1. Send output to Execution log
    • Go to File | Project properties...
    • Select the Run/Debug tab
    • Select Send run output to Execution Log in the Console I/O section:
      Select Send output to execution log
    • Close Project properties by clicking on the OK button

    Now when we run our program the output will be send to the execution log. To view the execution log we must select View | Execution log from the menubar. This will open the Execution log, and output from our application will be sent to this log window. The Execution log will add a tab for every application or applet, which we execute.

  2. Wait for user input
    Another way to take a look at the output in the DOS box, is to stop program execution, and wait for some user input. To stop program execution, and wait for user input, we must implement the following lines in our code:
      // Wait for user to press Enter key
      //
      try
      {
        Sytem.in.read();
      }
      catch(IOException ioex)
      {
        // do nothing, shouldn't happen
      }
    
    When our program reaches this statement, program execution will stop, and will only continue after the user presses Enter.


This webpage © 1997-2009 by Bob Swart (aka Dr.Bob - www.drbob42.com). All Rights Reserved.