webMathematica requires that Java, a Servlet container and Mathematica are installed on your system. This guide walks you through the following steps to get webMathematica installed and running on Mac:
- Setting Up Java
- Setting Up Tomcat
- Setting Up Mathematica
- Making Licensing Files Accessible to the “Tomcat” User
- Installing and Setting Up webMathematica
Download and run the Java installer.
- Go to http://tomcat.apache.org/download-80.cgi.
- Download the installer in the format apache-tomcat-N.M.QQ.tar.gz, where N.M.QQ represents the Tomcat version number you downloaded.
- In the location you wish to install the server, execute:
- To start the Tomcat server, in the Tomcat installation directory, execute:
- Open a web browser and submit “localhost:8080”. If Tomcat has been set up correctly, a page similar to the following one appears:
Common possible issues:
- The computer’s firewall is blocking requests to tomcat. Tomcat, by default, runs on port 8080. Ensure that the port is open to accept tcp packets on the system running the tomcat server.
- If you downloaded Java from Oracle’s website, the Tomcat server may not be able to find the Java installation. In such a case, set the system variable JAVA_HOME to Java’s installation directory, e.g. by executing the following on a bash command line or by adding these lines to .bashrc, if your Java was installed in
You will need to install Mathematica, activate Mathematica and move Mathematica's licensing information into a location that can be accessed globally on your machine.
Follow the instructions for installing Mathematica on Mac.
By default, Mathematica places its licensing information in a mathpass file in a user-specific location. To make your licensing information accessible to your “tomcat” account, copy the mathpass file into the globally accessible base directory of Mathematica and set its permission so that any account can read the file.
- To identify the location of your mathpass file, evaluate in Mathematica:
- To identify the base directory location, evaluate:
These folder locations are used in the following instructions.
- The Licensing directory may not yet exist. If so, create it by executing the following command:
- Copy the mathpass file to the Licensing directory of the base directory:
- Grant read access to the mathpass file for all accounts:
webMathematica’s installation files contain webMathematica.zip. Place it into the webapps directory of your Apache Tomcat servers and unzip it to ensure it is opened and unpacked at startup. Assuming that you have defined
$TOMCAT_INSTALL to represent the installation directory of your Tomcat server, evaluate the following:
Testing and Troubleshooting
The webMathematica package comes with some default pages that can be used to test the setup of webMathematica.
- Access the base page by pointing a browser to “localhost:8080/webMathematica”.
- As a first test, click the Hello World example. The Hello World page providing the current time and date appears.
- If Hello World is not working, check the log file by executing:
Common possible issue:
Search the log file for error
....com.wolfram.kerneltools.state.StateMachine [ERROR] Could not find MathLink executable. In such a case, webMathematica could not find the executable of the Mathematica kernel. This can occur if you have installed Mathematica in a non-standard location or if a version of webMathematica is not paired with the recommended Mathematica version; e.g. webMathematica 3.3.4 was released for Mathematica 10.4 and looks in the default installation directory of Mathematica for the executable.
To point to the correctly paired version of Mathematica, configure webMathematica.
- On the command line, go to
$TOMCAT_INSTALL/webapps/webMathematica/WEB-INF/and locate the file MSPConfiguration.xml.
- Open MSPConfiguration.xml in a text editor and locate the following section:
- Edit and change this section to:
Note: These instructions assume Mathematica 11.1 was installed to
/usr/local/Mathematica/11.1/. If you have a different installation directory, substitute the installation directory you used.