You should use Java 21 or later. While ArtiSynth is currently compiled to be compatible with Java 8, this will be raised to Java 21 in the near future.
If you are using the Eclipse IDE (Section 13), the version of Java that comes with Eclipse (Java 21 or later for Eclipse 2024-09 and newer) meets this requirement and is used by default to compile and run ArtiSynth. You will then need to install a separate Java development kit (JDK) only if
you want to compile or run ArtiSynth from a terminal window, outside of Eclipse; or
you need a specific version of Java. In particular, if you plan to use ArtiSynth with MATLAB, ArtiSynth should be run with Java 21, which is compatible with recent versions of MATLAB (see Interfacing ArtiSynth to MATLAB), whereas newer versions of Eclipse come with later versions of Java.
If you are not using Eclipse, you will need a JDK. A JDK includes a Java compiler, whereas a simple Java runtime environment (JRE) does not.
Any JDK of version 21 or later will work. Free builds of the JDK are available from several sources; we suggest Eclipse Temurin, available from
JDKs are also available from Oracle at www.oracle.com/java/technologies/downloads but may be subject to certain licensing restrictions.
Select your operating system and architecture, the package type JDK, and the desired version (21, or later). For MacOS, choose the architecture aarch64 if your Mac uses Apple silicon, or x64 if it uses an Intel processor. (To check, choose About This Mac from the Apple menu: the Chip entry will say “Apple M...” for Apple silicon.) The easiest option is then the .pkg installer.
The home directory for a JDK install is usually something like
/Library/Java/JavaVirtualMachines/temurin-21.jdk/Contents/Home
for Temurin and
/Library/Java/JavaVirtualMachines/jdk-21.jdk/Contents/Home
for Oracle.
Previous versions of these instructions asked that an Intel-based (x64) JDK be installed on Macs with Apple silicon, so that ArtiSynth would run under Rosetta. This is no longer necessary, as ArtiSynth now runs natively on Apple silicon.
To compile or run ArtiSynth from a terminal window, the java and javac commands of your JDK must be visible there, and must supersede any other Java installations. To check this, 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 zsh (which it will be by default), then the initialization file is <HOMEDIR>/.zshrc. Use a plain text editor to edit (or create) this file and insert a line of the form
The same line can be used if your shell is bash, in which case the initialization file is <HOMEDIR>/.bashrc.
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 "’".
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.