I am making a Minecraft launcher, and i would like to make my own ftb-style console to go with it. any ideas on how i would redirect Minecraft's print stream to a JTextArea
?
Asked
Active
Viewed 182 times
1

Andrew Thompson
- 168,117
- 40
- 217
- 433

TheUltraMineyCrafter
- 13
- 4
-
what's the problem: getting hold of the printstream or its output on a JTextArea? – kleopatra Jun 21 '13 at 16:20
2 Answers
0
You could use something like this StreamGobbler example: http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html?page=4
The other answers on this other SO question may also help: Capturing stdout when calling Runtime.exec

Community
- 1
- 1

David Ruhmann
- 11,064
- 4
- 37
- 47
0
You'll have to create an implementation of PrintStream
and replace System.out
and System.err
with it, by System.setOut
and System.setErr
, respectively. You might also want to replace System.in
for input, depending on whether this is for the MineCraft client or server.
There are many articles on piping PrintStreams to Swing components. On such article describing the process can be found here. A search engine query resembling "redirecting PrintStream to JTextPane" will also bring up a handful of links.

Xyene
- 2,304
- 20
- 36
-
i am already able to redirect the PrintStream, but for some reason when i start up minecraft's main class, it refuses to print – TheUltraMineyCrafter Jul 03 '13 at 20:16