Solved

print out the results of error handling to the dos window

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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
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 …

734 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