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?

Simone
  • 20,302
  • 14
  • 79
  • 103
asela38
  • 4,546
  • 6
  • 25
  • 31
  • 2
    Similar question and good answer here: http://stackoverflow.com/a/8194750/99717. Note that the question there asks also about javaws.exe, so not technically a duplicate... – Hawkeye Parker Aug 20 '14 at 04:00

4 Answers4

121

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

devstuff
  • 8,277
  • 1
  • 27
  • 33
Chandra Patni
  • 17,347
  • 10
  • 55
  • 65
  • 4
    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_. – Ti Strga Feb 06 '13 at 17:50
  • Following answer seems better to me and has Java documentation references: http://stackoverflow.com/a/8194750/99717 – Hawkeye Parker Aug 20 '14 at 04:03
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.

GuruKulki
  • 25,776
  • 50
  • 140
  • 201
  • 3
    doesn't javaw.exe also not show console output https://www.youtube.com/watch?v=AQUAyJYwJ6Q 0:57 http://i.imgur.com/TGsm45f.png – barlop Jan 28 '17 at 13:13
  • 3
    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.8` – Codeguard Dec 09 '19 at 17:54
46

The difference is in the subsystem that each executable targets.

  • java.exe targets the CONSOLE subsystem.
  • javaw.exe targets the WINDOWS subsystem.
David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490
15

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

Chathuranga Chandrasekara
  • 20,548
  • 30
  • 97
  • 138
  • 7
    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). – Joey Aug 01 '10 at 16:08