Solved

print out the results of error handling to the dos window

Posted on 2004-09-28
4
195 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
  • 2
4 Comments
 
LVL 11

Accepted Solution

by:
cjjclifford earned 50 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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
This video teaches viewers about errors in exception handling.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

758 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now