简体   繁体   中英

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

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 arguments...

This should do !!

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

jar -jar niidle.jar arguments > output

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

要将错误日志保存在一个文件中,而普通控制台日志则保存在另一个文件中:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM