I have a java file called "Ares.jar" that runs every 5 minutes via windows scheduled tasks, the batch calls:
java -jar Ares.jar >> Ares.log
I'm not seeing any error output, is there some way to make the errors (system.err.println / exception.printStackTrace(); )go to a file?
Thanks.
Output: The > operator is used to overwrite any file that already exists with new content. The >> operator is used to append to the text file (add to), instead of overwriting it.
1)open a notpad 2)copy and past this code and save this file as ex: test. bat 3)Double Click tha batch file. 4)put your java codes into the notepad and save it as N.B.:- save this java file same folder that your batch file exists. what's the purpose of opening up notepad when you just want to compile and run?
If you want to save the output from multiple commands to a single file, use the >> operator instead. This appends the output of a command to the end of the specified file, if it already exists. If the file doesn't exist, it creates a new one.
java -jar Ares.jar > Ares.log 2>&1
The second part of this command will redirect stderr to stdout, ensuring that both appear in the same file.
If you want regular logs and error logs in separate files, just use:
java -jar Ares.jar > Ares.log 2>Ares.error.log
You can get the full details of everything that is possible in the documentation, available from Microsoft: http://technet.microsoft.com/en-us/library/bb490982.aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With