After you install MATLAB® Runtime, add the run-time directories to the system library path according to the instructions for your operating system and shell environment.
Note
Ensure that the MATLAB Runtime directories are not already present in the path before adding them.
Save the value of your current library path as a backup before modifying it.
Your library path may contain multiple versions of MATLAB Runtime. Applications launched without using the shell script use the first version listed in the path.
When you run Java® applications that contain compiled MATLAB code, you must set the path so that the system can find MATLAB Runtime.
When you deploy a Java application to end users, they must set the class path on the target machine.
For their system to locate the .jar
files containing the MATLAB libraries, users must specify a classpath
either in the
javac
command or in their system environment variables. For more
information, see Configure Your Java Environment.
In order to use some screen-readers or assistive technologies, such as JAWS®, you must add the following DLLs to your Windows® path:
matlabroot\sys\java\jre\arch\jre\bin\JavaAccessBridge.dll matlabroot\sys\java\jre\arch\jre\bin\WindowsAccessBridge.dll
The MATLAB Runtime installer for Windows automatically sets the library path during installation. If you do not use
the installer, complete the following steps to set the PATH
environment
variable permanently.
Run C:\Windows\System32\SystemPropertiesAdvanced.exe
and
click the Environment Variables... button.
Select the system variable Path
and click
Edit....
Note
If you do not have administrator rights on the machine, select the user
variable Path
instead of the system variable.
Click New and add the directory
.
For example, if you are using MATLAB Runtime
R2021a located in the default installation directory on 64-bit Windows, add <MATLAB_RUNTIME_INSTALL_DIR>
\runtime\<arch>
C:\Program Files\MATLAB\MATLAB Runtime\v910\runtime\win64
.
Click OK to apply the change.
Execute the following command using Windows PowerShell with elevated privileges to save the current system path
as a variable named mypath
and display it in the
console.
($mypath = (Get-Item "HKLM:\System\CurrentControlSet\Control\Session Manager\Environment").GetValue("PATH", $null, "DoNotExpandEnvironmentNames"))
Append your MATLAB Runtime directory to the mypath
variable. If there is a
semicolon at the end of your current path or the path is empty, then delete the
semicolon from the following
command.
$mypath = "${mypath};<MATLAB_RUNTIME_INSTALL_DIR>\runtime\<arch>"
For example, if you are using MATLAB Runtime R2021a located in the default installation directory on 64-bit Windows, use the following command:
$mypath = "${mypath};C:\Program Files\MATLAB\MATLAB Runtime\v910\runtime\win64"
Display the value of mypath
to ensure the path is
correct.
echo %mypath%
Set the system path to the value of
mypath
.
Set-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH -Value $mypath
Sign out of Windows to apply the change.
In the terminal, display the SHELL
variable to determine your current
shell
environment.
echo $SHELL
Save your current library path as a variable named mypath
and display it in the
console.
mypath=$LD_LIBRARY_PATH && echo $mypath
Append the MATLAB Runtime directories to the mypath
variable. The following
command must be entered as a single line.
mypath="${mypath:+${mypath}:}
<MATLAB_RUNTIME_INSTALL_DIR>
/runtime/glnxa64:
<MATLAB_RUNTIME_INSTALL_DIR>
/bin/glnxa64:
<MATLAB_RUNTIME_INSTALL_DIR>
/sys/os/glnxa64:
<MATLAB_RUNTIME_INSTALL_DIR>
/extern/bin/glnxa64"
Note
If you are using OpenGL®, replace /extern/bin/glnxa64
with
/sys/opengl/lib/glnxa64
.
For example, if you are using MATLAB Runtime R2021a located in the default installation directory, use the following command entered on a single line:
mypath="${mypath:+${mypath}:}/usr/local/MATLAB/MATLAB_Runtime/v910/runtime/glnxa64:
/usr/local/MATLAB/MATLAB_Runtime/v910/bin/glnxa64:/usr/local/MATLAB/MATLAB_Runtime/v910/extern/bin/glnxa64"
Display the value of mypath
to ensure the path is
correct.
echo $mypath
Set the LD_LIBRARY_PATH
variable for the current
session.
export LD_LIBRARY_PATH=$mypath
To set the variable permanently, append the export
command
to a file in your home directory named
.bashrc
.
echo "export LD_LIBRARY_PATH=$mypath" >> ~/.bashrc
Type ldd --version
to check your version of GNU® C library (glibc
). If the version displayed is
2.17 or lower, add
to the <MATLAB_RUNTIME_INSTALL_DIR>
/bin/glnxa64/glibc-2.17_shim.soLD_PRELOAD
environment variable.
To apply changes to the current session, type source
~/.bashrc
.
In the terminal, display the SHELL
variable to determine your current
shell
environment.
echo $SHELL
Save your current library path as a variable named mypath
and display it in the
console.
mypath=$DYLD_LIBRARY_PATH && echo $mypath
Append the MATLAB Runtime directories to the mypath
variable. The following
command must be entered as a single
line.
mypath="${mypath:+${mypath}:}
<MATLAB_RUNTIME_INSTALL_DIR>
/runtime/maci64:
<MATLAB_RUNTIME_INSTALL_DIR>
/bin/maci64:
<MATLAB_RUNTIME_INSTALL_DIR>
/sys/os/maci64"
For example, if you are using MATLAB Runtime R2021a located in the default installation directory, use the following command entered on a single line:
mypath="${mypath:+${mypath}:}/Applications/MATLAB/MATLAB_Runtime/v910/runtime/maci64:
/Applications/MATLAB/MATLAB_Runtime/v910/bin/maci64:/Applications/MATLAB/MATLAB_Runtime/v910/sys/os/maci64"
Display the value of mypath
to ensure the path is
correct.
echo $mypath
Set the DYLD_LIBRARY_PATH
variable for the current
session.
setenv DYLD_LIBRARY_PATH $mypath
To set the variable permanently, append the setenv
command
to a file in your home directory named
.zshrc
.
echo "setenv DYLD_LIBRARY_PATH $mypath" >> ~/.zshrc
To apply changes to the current session, type source
~/.zshrc
.
Save your current library path as a variable named mypath
and display it in the
console.
mypath=$DYLD_LIBRARY_PATH && echo $mypath
Append the MATLAB Runtime directories to the mypath
variable. The following
command must be entered as a single
line.
mypath="${mypath:+${mypath}:}
<MATLAB_RUNTIME_INSTALL_DIR>
/runtime/maci64:
<MATLAB_RUNTIME_INSTALL_DIR>
/bin/maci64:
<MATLAB_RUNTIME_INSTALL_DIR>
/sys/os/maci64"
For example, if you are using MATLAB Runtime R2021a located in the default installation directory, use the following command entered as a single line:
mypath="${mypath:+${mypath}:}/Applications/MATLAB/MATLAB_Runtime/v910/runtime/maci64
:/Applications/MATLAB/MATLAB_Runtime/v910/bin/maci64:/Applications/MATLAB/MATLAB_Runtime/v910/sys/os/maci64
Display the value of $mypath
to ensure the path is
correct.
echo $mypath
Set the DYLD_LIBRARY_PATH
variable for the current
session.
export DYLD_LIBRARY_PATH=$mypath
To set the variable permanently, append the export
command
to a file in your home directory named
.profile
.
echo "export DYLD_LIBRARY_PATH=$mypath" >> ~/.profile
To apply changes to the current session, type source
~/.profile
.