Results 1 to 6 of 6
  1. #1
    anthropamorphic's Avatar
    anthropamorphic is offline Senior Member
    Join Date
    Jun 2011
    Posts
    135
    Rep Power
    0

    Default How To Get Text From The Console

    Hello, I am making a game and I've set up so that it displays most actions you do in the console almost as a crash log, and my problem is that I want to get the text that is out printed, how would I do that?

    I don't think I explained it very well so what I mean is if I System.out.println("hi"); how could I get the text that is in the console like "hi".

  2. #2
    sunde887's Avatar
    sunde887 is offline Moderator
    Join Date
    Jan 2011
    Location
    Richmond, Virginia
    Posts
    3,069
    Blog Entries
    3
    Rep Power
    8

    Default

    Why not just write it to a file?

  3. #3
    anthropamorphic's Avatar
    anthropamorphic is offline Senior Member
    Join Date
    Jun 2011
    Posts
    135
    Rep Power
    0

    Default

    Quote Originally Posted by sunde887 View Post
    Why not just write it to a file?
    I could, but I didn't think about that when I was writing it.

  4. #4
    Alerhau's Avatar
    Alerhau is offline Senior Member
    Join Date
    Jun 2011
    Location
    Sweden
    Posts
    158
    Rep Power
    4

    Default

    Are you writing it to a file now? Or could I give you a different alternative?
    Currently Developing a Game Called Loaie, You Can Download It From "The Loaie Website".

  5. #5
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,401
    Rep Power
    25

    Default

    System.out.println("hi"); how could I get the text that is in the console like "hi".
    Do you want to retrieve the String from the console
    or get it while it is going to the console,
    or get it as a String instead of it going to the console?

  6. #6
    Junky's Avatar
    Junky is offline Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,798
    Rep Power
    7

    Default

    The best option would be to properly implement logging. If you do not need the console for anything else (such as normal user input/output) then the quick and dirty way would be to use System.setOut().

Similar Threads

  1. Help with Console
    By thiagohe in forum Advanced Java
    Replies: 7
    Last Post: 08-01-2011, 01:30 PM
  2. Console Object
    By newbie123 in forum New To Java
    Replies: 2
    Last Post: 11-10-2009, 02:33 AM
  3. console appender to a text file
    By jazz2k8 in forum Advanced Java
    Replies: 2
    Last Post: 06-25-2009, 02:47 PM
  4. implementing a console
    By bilbodeb in forum Threads and Synchronization
    Replies: 2
    Last Post: 03-26-2009, 07:09 AM
  5. how to take input from console in jsp
    By veena in forum New To Java
    Replies: 1
    Last Post: 05-06-2008, 04:39 AM

Tags for this Thread

Posting Permissions

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