Solved

print out the results of error handling to the dos window

Posted on 2004-09-28
4
196 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
for i loop in grovy 1 44
backtracking recursion  code 19 53
how do i compare an object based on two fields 6 48
windows explorer path to command prompt 5 28
For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

919 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

14 Experts available now in Live!

Get 1:1 Help Now