Difference between java.exe and javaw.exe
Asked Answered
S

4

157

Recently I noted that some applications are running on javaw (not in java). What is the difference between them and how can I run my Swing application on javaw?

Soubrette answered 4/1, 2010 at 5:53 Comment(1)
Similar question and good answer here: https://mcmap.net/q/117276/-what-is-the-difference-between-39-java-39-39-javaw-39-and-39-javaws-39. Note that the question there asks also about javaws.exe, so not technically a duplicate...Harrumph
N
81

java.exe is the command where it waits for application to complete untill it takes the next command. javaw.exe is the command which will not wait for the application to complete. you can go ahead with another commands.

Nica answered 4/1, 2010 at 6:9 Comment(2)
doesn't javaw.exe also not show console output youtube.com/watch?v=AQUAyJYwJ6Q 0:57 i.imgur.com/TGsm45f.pngHexylresorcinol
This answer is incorrect. javaw.exe does wait until the program completes. It can be used safely as part of .bat script for example, and it will wait. However, when you manually start non-console programs from cmd.exe, the cmd.exe will not wait and return to command prompt immediately. Try it with notepad.exe vs ping 8.8.8.8Whitesmith
K
121

java.exe is the console app while javaw.exe is windows app (console-less). You can't have Console with javaw.exe.

Kettie answered 4/1, 2010 at 5:55 Comment(2)
I'll add that "the console app" here doesn't necessarily mean that "this was run from a console", only that java.exe is allowed to access its console. Running an applet from within a browser on Windows, for example, always uses java.exe even if my Java Control Panel is set to Hide the console window or even Do not start a console window.Demetriusdemeyer
Following answer seems better to me and has Java documentation references: https://mcmap.net/q/117276/-what-is-the-difference-between-39-java-39-39-javaw-39-and-39-javaws-39Harrumph
N
81

java.exe is the command where it waits for application to complete untill it takes the next command. javaw.exe is the command which will not wait for the application to complete. you can go ahead with another commands.

Nica answered 4/1, 2010 at 6:9 Comment(2)
doesn't javaw.exe also not show console output youtube.com/watch?v=AQUAyJYwJ6Q 0:57 i.imgur.com/TGsm45f.pngHexylresorcinol
This answer is incorrect. javaw.exe does wait until the program completes. It can be used safely as part of .bat script for example, and it will wait. However, when you manually start non-console programs from cmd.exe, the cmd.exe will not wait and return to command prompt immediately. Try it with notepad.exe vs ping 8.8.8.8Whitesmith
M
46

The difference is in the subsystem that each executable targets.

  • java.exe targets the CONSOLE subsystem.
  • javaw.exe targets the WINDOWS subsystem.
Mozellamozelle answered 12/4, 2013 at 11:49 Comment(0)
S
15

The javaw.exe command is identical to java.exe, except that with javaw.exe there is no associated console window

Salisbury answered 4/1, 2010 at 6:0 Comment(1)
Technically more correct: With javaw there is no associated console. The window isn't necessarily created (for example, when you run from an existing console window or completely in background).Bridewell

© 2022 - 2024 — McMap. All rights reserved.