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
).
There are several runtime-variables you can use to specify runtime directories:
- %EXE4J_EXEDIR%
This is the directory where the executable is located.
- %EXE4J_JVM_HOME%
This is the directory of the JRE that your executable is running with.
- %EXE4J_TEMPDIR%
For the "JAR in EXE" mode, this
variable will contain the location of the temporary directory for the JAR files.
In "regular mode" this variable is
not used.
These variables can be especially useful for adding JAR files to the bootclasspath.
exe4j has the ability to add specific VM parameters depending on the Java version. To set this up,
click on the Configure version specific VM parameters
button. In the dialog, add rows for each Java version that should receive specific VM parameters.
The comparison checks if the Java version string starts with the specified characters,
so "1.8" will match "1.8.0_60", for example. These VM parameters are added after the common VM parameters
so you can use them to override common settings.
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 exe file with the extension *.vmoptions
.
For example, if your exe file 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. For example, the contents of the VM parameter
file could be:
It is possible to include other .vmoptions
files from a .vmoptions
file with the
syntax
-include-options [path to other .vmoptions file]
You can use multiple includes in a single file, recursive includes are also supported.
You can also add this option to the fixed VM parameters. In that way, you can prevent having to
use the .vmoptions
file right next to the executable.
This allows you to to centralize the user-editable VM options for multiple launchers and to have
.vmoptions
files in a location that can be edited by the user if the installation directory is
not writable. You can use environment variables to find a suitable directory, for example
-include-options ${APPDATA}\My Application\my.vmoptions
or
-include-options ${USERPROFILE}\.myapp\my.vmoptions
In addition to the VM parameters you can also modify the classpath in the .vmoptions
files with the
following options:
- -classpath [classpath]
Replace the classpath of the generated launcher.
- -classpath/a [classpath]
Append to the classpath of the generated launcher.
- -classpath/p [classpath]
Prepend to the classpath of the generated launcher.
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.