开发者

How to redirect jar output from ubuntu command prompt to text file

开发者 https://www.devze.com 2023-02-05 02:04 出处:网络
I created jar file and I run it using command as follows: $ java -jar niidle.jar arguments... it is showing correct output.

I created jar file and I run it using command as follows:

$ java -jar niidle.jar arguments...

it is showing correct output. But I cant see the whole output. I want to see the whole output. so how to redirect this whole thing to text file, when I run following command:

$ java -jar niidle.jar argume开发者_如何学Cnts...


jar -jar niidle.jar arguments > output


This should do !!

java -jar class.jar 2>> log.txt


To save error logs in a file and normal console logs in another file:

java -jar niidle.jar arguments 2> errorOutput.log > output.log


If you do not need to save the output for future reference, you can read the full output this way:

java -jar niidle.jar arguments | less

Obviously, we are supposing that there is no user interaction. Otherwise you can do something like the following example to save the output and review it later.

java -jar niidle.jar arguments | tee output
... some user interaction ...
less output
0

精彩评论

暂无评论...
验证码 换一张
取 消