1. Welcome to the new MacRumors forums. See our announcement and read our FAQ

Save Output in java...

Discussion in 'Mac Programming' started by Vasileios, Nov 22, 2005.

  1. macrumors regular

    Vasileios

    #1
    Is there a way that i can save all the output that i have on the screen(Numbers and text) into a text file?
    Thanks...
     
  2. macrumors 68040

    plinden

    #2
    Can we have more info on what you're doing and trying to do please?
     
  3. macrumors 601

    HiRez

    #3
    Need a bit more information. What is the format of your Java app? Is your app being run from the command-line and where the numbers and text are being printed to the console, or do you have a graphical app where they are they in UI objects like tables and text fields?
     
  4. macrumors regular

    Vasileios

    #4
    it's a simple quess game...
    the results (the number you enter-if you quess is too low, or too hight, the choice to play again etc.) are printed in the console... no grafics at all... just text...
     
  5. macrumors 603

    jeremy.king

  6. macrumors 68040

    plinden

    #6
    Even simpler than adding to your code - run in command line with '>' i.e.:

    java -cp . MyClass > result
     
  7. macrumors 603

    jeremy.king

    #7
    Guess that would work too. But I figured he was asking how to code it since it is a programming forum category.
     
  8. macrumors 601

    Compile 'em all

    #8
    Probably in your program you are using System.out.println() to write text to
    the console. Instead use FileWriter to write to a file. As a MacRumors fellow
    pointed out, take a look at Java I/O docs on SUN's website.
     

Share This Page