HOWTO: Suppress the console window in GUI applications
Article ID: 000013
Last Revised On: 26-Dec-2005
PDF Version: 000013.pdf
The information in this article applies to:
- Excelsior JET since version 2.5
An EXE created by Excelsior JET with default settings opens a console window on startup, as if your application is started using the java
launcher. However, Java applications with graphical user interface are usually started with the javaw
launcher, which does not open a console window. This article describes how to prevent the console window from appearing on executable startup and how to re-enable it without rebuilding the executable.
By default, the standard input/output/error streams are enabled to let the application print messages to the console. As a result, when starting your GUI application, you see a black console window opened in addition to the application’s frames. If you do not want the window to appear, you can suppress it for the application:
- Using JET Control Panel: Check the Hide console window checkbox on the Appearance page.
- In the project file: Turn on the GUI option:
In Excelsior JET 4.0, this checkbox is placed on the Resources
page. In Excelsior JET versions prior to 4.0, the checkbox was named Suppress console window
and placed on the Target
This setting has no effect on DLLs.
Under certain circumstances, you may wish the console to be created for a GUI program, e.g. if you need to view diagnostic messages printed to standard output. The subsystem is specified in EXE header, so it is possible to switch it without recompilation. You may do that using the GUI.EXE utility, which is part of Excelsior JET 3.1 and above.
To force MyApp.EXE to the console subsystem:
gui - myapp.exe
To force MyApp.EXE to the window subsystem:
gui + myapp.exe
To query the current subsystem setting in MyApp.EXE:
gui ? myapp.exe