Reputation: 173
i've a GUI (done with eclipse and windowbuilder), i would like to open (in a jframe or in a new window near from my GUI) a console which displays my System.out.println and my printstacktrace (inter alia).
How can i do that? Do i really have to develop a console?
(I don't want to be sure that the user launched my jar from his cmd.exe)
Upvotes: 2
Views: 1616
Reputation: 209
There is a SourceForge project that will pop a console window for displaying multiple object types.
From the project:
Description
The Java42 Development Console is a replacement for Java's System class. This is a development tool intended to be used during application development but can also be packaged and shipped with your product.
Example usage:
import java42.lang.System;
System.getManager().initialize(owner); // Owner is your app's JFrame
// All System.out.xxx methods are routed to the console.
// Print text:
System.out.println("Hello Console");
// Print components:
System.out.println(new JButton("Hello Console"));
// Print images:
System.out.println(ImageIO.read(imageStream));
Upvotes: 2
Reputation: 8623
Using System.setOut
and System.setErr
, you can re-direct console output to PrintStream
s of your choice. So you can send all output to a text area inside your frame.
Upvotes: 3