How to output java -jar errors to a text/log file?

前端 未结 2 1140
一个人的身影
一个人的身影 2020-12-15 08:47

i have googled my heart out! I am trying to figure out how to output any errors a java class might give when executing java from the Windows command line.

For insta

相关标签:
2条回答
  • 2020-12-15 09:46

    Use:

    java -jar class.jar <someFile.file> 2>> log.txt
    

    The 2 redirects the error stream.

    0 讨论(0)
  • 2020-12-15 09:48

    or you can use bat file to easily direct all output to a text file in command prompt

    C:> something.bat > console_output.txt

    0 讨论(0)
提交回复
热议问题