Solved

print out the results of error handling to the dos window

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
String array comparison 4 45
SequenceInputStream example 3 22
Html Table Looping (part 2) 5 35
Delete .class files at every compile 4 19
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

749 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