Main Content

Specifying Java Startup Options

You can specify custom Java® startup options by creating a java.opts file, a text file containing one option per line. For example, use the -Dproperty=value command to assign a value to a system property.

Put the java.opts file in one of the following folders:

  • MATLAB® startup folder, if starting MATLAB from an operating system prompt. For more information, see MATLAB Startup Folder.

  • If there is no java.opts file in the startup folder, then MATLAB checks the matlabroot/bin/arch folder. matlabroot is the output of the matlabroot function. arch is the output of the MATLAB computer('arch') function, for example glnxa64.

    A java.opts file in this location applies to all users, but individual users might not have permissions to modify files there.

Do not use a java.opts file in the following situations:

  • To enable the use of the Java debugger, use the matlab -jdb command. For information, see matlab (Linux) or matlab (macOS).

  • To adjust the Java heap size on desktop versions of MATLAB, use Java Heap Memory Preferences.

  • To modify the static Java class path, create a javaclasspath.txt file. For information, see Static Path.

    To modify the library path, create a javalibrarypath.txt file. For information, see Locate Native Method Libraries.

  • To override built-in options that MATLAB specifies to Java at startup. Options in java.opts are appended to the end of the built-in list. Whether these additional options override built-in options is JVM-dependent and can change between Java versions. To see what options MATLAB provides to Java, run this command:

    java.lang.management.ManagementFactory.getRuntimeMXBean.getInputArguments

See Also

|

Related Examples

More About