Suppose I have an executable JAR that launches a Swing GUI. If it is launched from the console (e.g. java -jar myapp) then the console is also used by the application (i.e. logs are being printed). This logging takes a bit time, it’s quite verbose.
Note, that I only have a JAR, not the sources.
Question: what happens when you double-click run a JAR? Obviously no logs are visible, but are they simply invisible, or does this indeed boost the performance of the application (by skipping logging)?
System.out.prinln()prints to the output stream of the process. The JVM doesn’t know and care about where the output actually goes. It could be the console, or it could be redirected to a file, or piped to another process, or sent to nowhere. The instruction is a blocking operation, so the time taken by the instruction depends on where it actually goes. Printing to a console is slower than printing to a file, which is slower than printing to nowhere.