tags:

views:

134

answers:

1

I want to redirect FULL output of my program to a file (including Exceptions) in bash. I can't change content of class. I run it like that:

java -Djava.security.manager -Djava.security.policy=JLPPolicy -Xmx16M -Xms2M -cp /var/tomcat/bin/ Main > File

Exceptions are send to console, which is bad for me. Can I do something with it?

+4  A: 

Assuming you're using bash you can run the command with 2>&1 appended to the end of the command; e.g

> File 2>&1

This will redirect file descriptor #2 (stderr) into file descriptor #1 (stdout) which you've already directed to the named file.

You could also try:

>& File

... which should direct both stdout and stderr.

Adamski
perfect. Thx :)
tzim