How Can I Pipe the Java Console Output to File Without Java Web Start?

前端 未结 4 865
暗喜
暗喜 2020-12-16 02:59

I am wanting to pipe the Java console output (generated by System.out.println and its ilk) to a file. I found an excellent solution here to enable Java tracing,

4条回答
  •  自闭症患者
    2020-12-16 03:09

    If you launch it from command line, then you can use redirect stdout and stderr into file as follows:

    java -jar application.jar >file.txt  2>&1
    

    where you have to replace application.jar with the jar file of your application.

提交回复
热议问题