1

The application creates and displays various Swing widgets, and also writes debugging messages to System.out. If I start it as java -jar ...jar then I see it, but if I click on jar file in GUI I don't see the console. How to make it show console to user explicitly, e.g. on reaction to "View -> Debug output" menu item?

Expecting something that will pop up cmd.exe window on Windows, xterm/... on Linux, but it may be Swing window as well. How to do it the easily?

3 Answers 3

3

First don't use System.out to log, use some Logging framework to write logs in some file and to display the debugging logs open a new JDialog with JTextArea or JTextPane in it. Read the log file content and display that in the textArea. This way it will also solve platform dependency.

Sign up to request clarification or add additional context in comments.

Comments

1

I think that you looking for CTRL + SHIFT + F1 works if is GUI visible here you can see output to the console, with Tree hierarchy of JComponents

Comments

0

AFAIK on Windows the console would be displayed on the first console output (i.e. System.out.printXXX), while on Linux it must be executed from console itself to do so. I'd rather create a separate window with a JTextArea (or something similar) to display the debug output. Normal users won't care about / need it, right?

2 Comments

No, in Windows it does not pop up the console on output to it. Probably will use more proper logger and JTextWhatever log window.
Hmm... it does on my XP, if the interpreter used is java instead of javaw.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.