I have a program where, during a long task, I use System.out to print messages to indicate its progress. However, this can only be seen in the terminal in Visual Studio Code.
When I export the program to a jar file and double-click it, it doesn’t print out any System.out messages, although it is still able to do its tasks.
So, how do I make my program open a terminal upon double-clicking its jar file so that it can print messages to it in a similar manner as using System.out?
2
Answers
Try running with java cli. This is basically what your IDE does when you run your project.
If you don’t want to keep your console open and still persist logs, I would suggest using log4j or just simply redirect output of System.out to file
You can easily change where stderr and stdout go: