What is the difference between java and javaw?
That‘s because Windows has this annoying habit of starting an actual Terminal (which should not even be called a "Terminal"...) in the foreground whenever you start a program with java -cp ...
. As almost nobody wants that, javaw
is the choice to make that annoying window disappear.
The java
tool launches a Java application. It does this by starting a Java runtime environment, loading a specified class, and invoking that class‘s main
method.
java: Java application executor which is associated with a console to display output/errors
The javaw
command is identical to java
, except that with javaw
there is no associated console window. Use javaw
when you don‘t want a command prompt window to appear.
java: Java application executor which is associated with a console to display output/errors
javaw: (Java windowed) application executor not associated with console. So no display of output/errors. It can be used to silently push the output/errors to text files. It is mostly used to launch GUI-based applications.
java.exe is associated with the console, whereas javaw.exe doesn‘t have any such association. So, when java.exe is run, it automatically opens a command prompt window where output and error streams are shown.
原文:https://www.cnblogs.com/dissipate/p/13734797.html