Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

print out the results of error handling to the dos window

Posted on 2004-09-28
4
Medium Priority
?
202 Views
Last Modified: 2010-03-31
Hey all,

I've created a simple program to zip files on the fly and I created a Jar file out of it.  Couldn't be happier with it.  However, System.out.println("Some Error Occurred"); does not print out anywhere!!!

I'm currently invoking this from the dos window and I would like the results of my error handling to print there as well.  It does so when I use the java -jar command but not when I simply call it using the windows start command.  Any idea why.

Any help appreciated.
0
Comment
Question by:dds110
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 11

Accepted Solution

by:
cjjclifford earned 200 total points
ID: 12170872
I'm not a windows user (used to be, for my sins!), so I can't check this, but the "start" command starts programs without console window, so "System.out.println()" generally going to the Standard output, will not go anywhere.
You may be able to redirect the output to a file (start java -jar  > log.txt) and monitor that log file from another window.
However, you'd be better off investing a few minutes looking into some standard logging mechanism, either java.util.logging, or log4j (preferable IMO) - http://logging.apache.org/log4j/docs/
0
 
LVL 11

Expert Comment

by:cjjclifford
ID: 12170892
btw, if you are going to use System.out.println(), you might consider using System.err.println() which writes to the standard error. Proper Operating Systems (*nix) allow redirecting stdout and stderr seperately, don't think MS OS do - just a good habit to get into...
0
 
LVL 12

Expert Comment

by:Giant2
ID: 12171032
maybe the start command could not have a System consolle. So you cannot see the System.out done by code.
0
 
LVL 8

Author Comment

by:dds110
ID: 12173169
good points cjjclifford.  Thanks for the info.  Since this program will be executed on a web server(hopefully), I'm not going to put too much effort into actually "viewing" the errors.  I've set it up so that it "crashes" gracefully.

Thanks
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question