jQuery in Action, 2nd edition*
The moose likes Java in General and the fly likes How to log java.exe errors in bat file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "How to log java.exe errors in bat file" Watch "How to log java.exe errors in bat file" New topic
Author

How to log java.exe errors in bat file

Michael Moe
Greenhorn

Joined: Aug 30, 2003
Posts: 5
Hi! I have a DOS Batch file that is executed by a Mainframe process. I need to be able to trap any errors generated by running the java program (like class not found), but have not been able to do it as yet. I found that I can check the ErrorLevel and find that an error happened, but I would like to know the specific error. I tried redirecting the output of the java command, but that did not work:
java class > error.log
The file was generated, but no data.
Any ideas?
Stefan Wagner
Ranch Hand

Joined: Jun 02, 2003
Posts: 1923

Normal messages are printed to System.out.
Error messages are printed to System.err.
The errorstream has a description-number '2';
to log the errors:
java Buggy 2> error.log


http://home.arcor.de/hirnstrom/bewerbung
Michael Moe
Greenhorn

Joined: Aug 30, 2003
Posts: 5
That did it! Thanks!
 
 
subject: How to log java.exe errors in bat file
 
Similar Threads
eclipse jdt compiler IProblem (getting the line number of compilation error)
Help! Where to put a bean class
java documentation
Error handling in JSP
please tell me.......................