exe4j Wizard - Step 4: Configure Executable

     


In this step of the exe4j wizard, you enter the properties of the executable that is to be generated.
  The following properties of the executable can be edited in the Executable section of this step:
  • Executable type
    Executables created by exe4j can be either GUI or console applications:
    • GUI application
      There is no terminal window associated with a GUI application. If stdout and stderr are not redirected (see the redirection advanced step), both streams are inaccessible for the user. This corresponds to the behavior of javaw.exe.

      If you launch the executable from a console window, a GUI application can neither write to or read from that console window. Sometimes it might be useful to use the console, for example for seeing debug output or for simulating a console mode with the same executable. In this case you can select the Allow -console parameter check box. If the user supplies the -console parameter when starting the launcher from a console window, the launcher will try to acquire the console window and redirect stdout and stderr to it. If you redirect stderr and stdout in the redirection settings, that output will not be written to the console.

    • Console application
      A console application has an associated terminal window. If a console application is opened from the Windows explorer, a new terminal window is opened. If stdout and stderr are not redirected (see the redirection advanced step), both streams are printed on the terminal window. This corresponds to the behavior of java.exe.
    • Service
      A Windows service runs independently of logged in users and can be run even if no user is logged on. The main method will be called when the service is started.

      To handle the shutdown of the service, you can use the Runtime.addShutdownHook() method to register a thread that will be executed before the JVM is terminated.

      For information on how services are installed or uninstalled, please see the help on service start options.

  • Executable name
    Enter the desired name of the executable without the trailing .exe.
  • Icon file
    If you would like a custom icon to be compiled into your executable, select the Icon file checkbox and choose an icon file (extension *.ico).
  • Working directory
    For some applications (especially GUI applications) you might want to change the working directory to a specific directory relative to the executable, for example to read config files that are in a fixed location. To do so, please select the Change working directory to: checkbox and enter a directory relative to the executable in the adjacent text field. To change the current directory to the same directory where the executable is located, please enter a single dot.
  • Allow only a single running instance of the application
    If you select this checkbox, the generated exe4j executable can only be started once. Subsequent user invocations will bring the application to the front. In the Controller class of the exe4j launcher API you can register a startup handler to receive the command line parameters. In this way, you can handle file associations with a single application instance.
  • Fail if an exception in the main thread is thrown
    Executables created by exe4j can monitor whether the main method throws an exception and show an error dialog in that case. This provides a generic startup error notification facility for the developer that handles a range of errors that would otherwise not be notified correctly. For example, if an uncaught exception is thrown during application startup, a GUI application might simply hang, leaving the user in the dark about the reasons for the malfunction. With the error message provided by the exe4j executable, reasons for startup errors are found much more easily.