ArtiSynth requires that you have a full 64-bit Java development kit (JDK) installed. A JDK comes with a Java compiler, whereas the simpler Java run time environment (JRE) does not.
Important: on ARM-based machines, you must still install a 64-bit Intel-based JDK which must then execute through an Intel compatibility layer. Invocation of the compatibility layer should generally be invisible to the user. 64-bit Intel-based JDKs contain the string x64 in their download names, whereas ARM-based JDKs contain aarch64 or arm32.
You will require JDK version 8 or higher. The most recent JDK with long term support is version 21. If you are planning to use ArtiSynth with MATLAB, there are restrictions on which JDK you can use, as described in the guide Interfacing ArtiSynth to MATLAB.
If you need a JDK, we recommend installing one from Oracle. At the time of this writing, the download page is at:
Download tabs for JDK 22, 21 and 17 are located near the top. Tabs for downloading JDK 8 and 11 are located further down the page. Downloads are available for all systems (Linux, macOS and Windows); be sure to choose the link appropriate to yours. For MacOS, you must choose one of the x64 options, even if your system uses an Apple M chip, to ensure that Java runs in Intel compatibility mode. The easiest install option may be “x64 DMG Installer”.
After the JDK has been installed, it is important to ensure that it is visible to your system and that it supersedes any other Java installations. One test for this is to open a terminal window and run the command
> javac -version
The output should match the version of the installed JDK. If it does not, or if the command javac is not found, then you can set the “default” JDK by setting the JAVA_HOME environment variable. This can be done inside the initialization file for your command line shell. Assume that the desired JDK has version number 21 and that your home directory is <HOMEDIR>.
If your command line shell is bash (which it will be by default), then the initialization file is <HOMEDIR>/.bashrc. Use a plain text editor to edit (or create) this file and insert a line of the form
If you have changed your shell to csh or tcsh, then the initialization file is <HOMEDIR>/.cshrc. Use a plain text editor to edit or create this file and insert a line of the form
Note that in both examples above, the left quote character "`" is used instead of the more common right quote "’". Also, for JDK 8, it may be necessary to specify the argument -v 1.8.0 to java_home.
Setting JAVA_HOME can also be done directly within the shell; doing it within the initialization file simply avoids the need to do so each time a new terminal window is opened.