File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes System.out.println() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "System.out.println()" Watch "System.out.println()" New topic


Paul Keohan
Ranch Hand

Joined: Mar 15, 2000
Posts: 411
I have a jar file which contains several classes that have contained in them. This code is 'attached' to another far bigger application which runs a Swing GUI but doesn't have a DOS window. Is it possible that having these System.out.printlns could cause a problem when they are reached - because there's nowhere to write to. At least nowhere that I can see.
I don't have any way of making the GUI application launch a DOS window.
Joel McNary

Joined: Aug 20, 2001
Posts: 1824

As far as I know, these are not a problem; the Swing GUI is probably running by invoking javaw instead of java (the latter has a command prompt, the former does not), and I've never had any problems with my printlns.

Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.
Loren Rosen
Ranch Hand

Joined: Feb 12, 2003
Posts: 156
You could also redirect System.out to a file or to a Swing window using System.setOut()
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
In your case i would use a logging framework like log4j or logkit (based on log4j) there you can
easily set up logging into a file.
(You see log4j in all App Servers and most of the tools)
It is a jakarta framework which you can findhere
There you can write to so called appenders (console, syslogd, file etc.)
[ June 06, 2003: Message edited by: Oliver Refle ]
I agree. Here's the link:
subject: System.out.println()
It's not a secret anymore!