Step 4: Configure Java invocation

  
 previous up next 


In this step of the generated launcher wizard, you enter the information required to start your application.
  The following properties of the java invocation can be edited in the General section of this step:
  • Main class
    Enter the fully qualified main class of your application. Next to the text field is a [...] chooser button that brings up a dialog with a list of all public main classes in the class path. To use this facility, you have to set up your classpath first (see below).
  • VM parameters
    If there are any VM parameters you would like to specify for the invocation of your Java application, you can enter them here (e.g. -Dmyapp.myproperty=true or -Xmx256m).

    Note: You must quote parameters that contain spaces. Please quote the entire parameter like "-Dapp.home=%INSTALL4J_EXEDIR%" and not just the value. Incorrect quoting will lead to failure of the launcher.

    There are several variables you can use to specify runtime directories:

    • %INSTALL4J_EXEDIR%
      This is the directory where the executable is located.
    • %INSTALL4J_JVM_HOME%
      This is the directory of the JRE that your executable is running with.
    • %INSTALL4J_PATHLIST_SEPARATOR%
      This is the character used to separate path lists (";" on Windows, ":" on Unix and Mac OS X)

    These variables can be especially useful for adding JAR files to the bootclasspath.

    Note for Microsoft Windows and Unix launchers: In addition to these VM parameters, a parameter file in the same directory as the executable is read and its contents are added to the existing VM parameters. The name of this parameter file is the same as the executable file with the extension .vmoptions. For example, if your executable is named hello.exe, the name of the VM parameter file is hello.vmoptions. In this file, each line is interpreted as a single VM parameter. The last line must be followed by a line feed. install4j adapts your .vmoptions files during the compilation phase so that the line endings are suitable for all platforms. For example, the contents of the VM parameter file could be:

          -Xmx128m
          -Xms32m
          

    You can use environment variables in the VM parameters with the following syntax: ${VARIABLE_NAME} where you replace VARIABLE_NAME with the desired environment variable.

  • arguments
    If you need to specify arguments for your main class, you can enter them here. Arguments passed to the executable will be appended to these arguments.
  • Allow VM passthrough parameters
    If you would like to allow the user to specify VM parameters with the syntax -J[VM parameter] (e.g. -J-Xmx512m), select the Allow VM passthrough parameters checkbox.

    Note: This setting applies only to Windows launchers. On Unix platforms you can use the INSTALL4J_ADD_VM_PARAMS environment variables to add VM parameters to the launcher. On Mac OS X, you can edit the Info.plist file to change the VM parameters.

  In the Class path section of this step you can configure the class path and the error handling for missing class path entries. The class path list shows all class path entries that have been added so far. The following types of class path entries are available:
  •  Scan directory
  •  Directory
  •  Archive
  •  Environment variable

The symbol prepended to an entry indicates that an error with that entry will lead to a startup failure with an error message displayed to the user. The control buttons on the right allow you to modify the contents of the class path list:

  •  Add class path entry (key INS)
    Invokes the class path entry dialog. Upon closing the class path entry dialog with the [Ok] button, a new class path entry will be appended to the bottom of the class path list.
  •  Remove class path entry (key DEL)
    Removes the currently selected class path entry without further confirmation. Also available from the context menu.
  •  Move class path entry up (key ALT-UP)
    Moves the selected class path entry up one position in the class path list. Also available from the context menu.
  •  Move class path entry down (key ALT-DOWN)
    Moves the selected class path entry down one position in the class path list. Also available from the context menu.

To change the error handling mode of a class path entry, select the class path entry and press [Toggle 'fail on error'] right below the class path list or choose the corresponding menu item from the context menu.

  Click [Next] to proceed to the next step or [Cancel] to leave the generated launcher wizard without applying any changes.