Results 1 to 3 of 3
  1. #1
    myka is offline Member
    Join Date
    Mar 2010
    Posts
    10
    Rep Power
    0

    Exclamation Java main method (J2SE)

    Hi i just wanted to know is there a way to WRITE the whole output result of a main method into a single file ?


    Is there a way to do this ? or do I have to put the file writer part to the each location where i want to write it?:confused:
    Last edited by myka; 03-19-2010 at 07:43 PM.

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,525
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by myka View Post
    Hi i just wanted to know is there a way to WRITE the whole output result of a main method into a single file ?


    Is there a way to do this ? or do I have to put the file writer part to the each location where i want to write it?:confused:
    There are several options:

    1) redirect the stdout stream outside of Java, e.g "java YourClass > yourfile.txt"
    2) use the System.setOut( ... ) method before you print anything.

    kind regards,

    Jos
    Last edited by JosAH; 03-19-2010 at 08:01 PM.

  3. #3
    myka is offline Member
    Join Date
    Mar 2010
    Posts
    10
    Rep Power
    0

Similar Threads

  1. java graphics within main method
    By jforce93 in forum New To Java
    Replies: 4
    Last Post: 02-02-2010, 10:33 PM
  2. calling method from main method
    By bob_bee in forum New To Java
    Replies: 4
    Last Post: 10-02-2009, 05:30 PM
  3. Help me for main method
    By eliCanzee in forum AWT / Swing
    Replies: 1
    Last Post: 05-26-2009, 12:43 PM
  4. J2Se and Java
    By sweetnuts in forum Introductions
    Replies: 0
    Last Post: 10-19-2008, 10:14 PM
  5. The main method in java...
    By lenny in forum New To Java
    Replies: 1
    Last Post: 07-31-2007, 06:21 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •