Interfacing ArtiSynth to MATLAB

2 Requirements and configuration

As of July 2024, ArtiSynth has been tested to run with MATLAB 2024a.

2.1 Java restrictions

In order to interface ArtiSynth with MATLAB, the Java versions used by ArtiSynth and MATLAB must match. Since the Java versions available for MATLAB are limited, this also restricts which versions of the Java development kit (JDK) you can use to compile and run ArtiSynth.

  • MATLAB (through 2024) comes bundled with Java 8. To use ArtiSynth with this default MATLAB configuration, you must use ArtiSynth with JDK 8.

  • MATLAB 2023 (or later) can also be configured to run with JDK 11, and MATLAB 2024 can be configured to run with JDK 17. If you configure MATLAB to run with one of these JDKs (via the MATLAB jenv command), then you can also use that JDK for ArtiSynth.

Verify that you do in fact have the correct JDK installed, and, if you are using an integrated development environment (IDE) to develop ArtiSynth code, check that the IDE is also using that JDK. Details on installing Java JDKs can be found in the installation guides for Windows, MacOS, and Linux.

2.2 Configuring MATLAB for ArtiSynth

In the following, assume that <ARTISYNTH_HOME> denotes the path to the ArtiSynth installation folder.

  1. 1.

    If you have not done so already, set the environment variable ARTISYNTH_HOME to <ARTISYNTH_HOME>. This can be done externally to MATLAB (see the Section Environment variables in the ArtiSynth Installation Guide for your system), or it can also be done within a MATLAB startup script using the setenv() command; see the MATLAB documentation regarding startup scripts.

  2. 2.

    Make sure that the folder <ARTISYNTH_HOME>/matlab is included in the search path for MATLAB functions; consult MATLAB documentation on how to do this.

  3. 3.

    Ensure that classes required by ArtiSynth are added to the MATLAB Java classpath, as described in Section 7.

  4. 4.

    If you have not done so already, add the ArtiSynth native library folder to the environment variable that specifies the dynamic library search path.

    1. (a)

      On Windows (64 bit), make sure <ARTISYNTH_HOME>\lib\Windows64 is included in the PATH environment variable.

    2. (b)

      On Linux (64 bit), make sure <ARTISYNTH_HOME>/lib/Linux64 is included in the LD_LIBRARY_PATH environment variable.

    3. (c)

      On MacOS, make sure <ARTISYNTH_HOME>/lib/MacOS64 is included in the DYLD_LIBRARY_PATH environment variable.

    For more information on setting these variables, see the Section Environment variables in the ArtiSynth Installation Guide appropriate to your system.

  5. 5.

    Depending on how much memory your ArtiSynth application requires, you may need to adjust the MATLAB Java virtual memory limit (Section 6).

  6. 6.

    As necessary, add the classpath(s) for your ArtiSynth models to the MATLAB Java classpath, so that they will be visible to Java from within MATLAB. See Section 8 for details.