Skip to content

-Xoptionsfile

Specifies a file that contains VM options and definitions.

The contents of the options file are recorded in the ENVINFO section of a Java™ dump.

Syntax

    -Xoptionsfile=<file_name>
where <file_name> specifies a file that contains options that are processed as if they had been entered directly as command-line options.

Explanation

At startup, the VM automatically adds -Xoptionsfile=<path>/options.default at the beginning of the command line, where <path> is the path to the VM directory.

Start of content that applies only to Java 8 (LTS) <path> is the VM directory, as shown in Directory conventions. End of content that applies only to Java 8 (LTS)
Start of content that applies only to Java 11 and later <path> is the <java_home>/lib directory, where <java_home> is the directory for your runtime environment. End of content that applies only to Java 11 or later

The file options.default can be updated with any options that you want to specify at run time.

The options file does not support these options:

Although you cannot use -Xoptionsfile recursively within an options file, you can use -Xoptionsfile multiple times on the same command line to load more than one options files.

Some options use quoted strings as parameters. Do not split quoted strings over multiple lines using the forward slash line continuation character (\). The Yen symbol (¥) is not supported as a line continuation character. For example, the following example is not valid in an options file:

-Xevents=vmstop,exec="cmd /c \
echo %pid has finished."

The following example is valid in an options file:

-Xevents=vmstop, \
exec="cmd /c echo %pid has finished."

Example

Here is an example of an options file:

#My options file
-X<option1>
-X<option2>=\
<value1>,\
<value2>
-D<sysprop1>=<value1>

See also