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 Windows:
- Setting Up Java
- Setting Up Tomcat
- Setting Up Mathematica
- Making Licensing Files Accessible to the “Tomcat” User
- Installing and Setting Up webMathematica
- Testing the Front End
Download and run the Java installer.
- Download and run the Tomcat installer. We recommend downloading the Windows Service Installer apache-tomcat-N.M.QQ.exe where N.M.QQ represents the Tomcat version number you downloaded.
- It is recommended that you create a user account to run the Tomcat server, typically called “tomcat”.
- In the Start Menu under Apache Tomcat, open the Configure Tomcat application.
- To set the account information of the Tomcat server, select the Log On tab.
- Select “This account” and enter the account information.
- Click Apply to confirm the changes.
- To start the Tomcat server, return to the General tab.
- Click the Start button.
- Click OK to close the application.
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. Open the port to accept TCP packets on the system running the Tomcat server.
- If Java is installed in a non-default location, set an environment variable, JAVA_HOME, to inform Tomcat of the location of the Java installation.
- Open the Control Panel and search for “System”.
- Click “Edit the system environment variables”. The System Properties dialog appears.
- Click the Environment Variables button.
- Click the New button under System Variables. The New System Variable window appears. Enter “JAVA_HOME” as “Variable name” and the installation location of the Java JDK as “Variable value”.
- Click the OK button in either window to confirm and close the windows.
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 Windows.
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:
- Copy the mathpass file at the $PasswordFile location and paste it to the Licensing subdirectory of the $BaseDirectory location. To access these directories, you may need to enable viewing hidden files and folders on Windows.
- From your webMathematica download, get the webMathematica.zip file and extract it into the “webapps” subdirectory of the Tomcat installation directory, which is typically at C:Program FilesApache Software FoundationTomcat 8.0.
- Restart the Tomcat server in the Configure Tomcat application.
Testing and Troubleshooting
The webMathematica package contains several test webpages.
- Point a browser to “localhost:8080/webMathematica”.
- Click the Hello World example.
<Tomcat_Install>/webapps/webMathematica/WEB_INF/MSPConfiguration.xmlin a text editor, where
<Tomcat_Install>represents the Tomcat installation directory.
- Locate the following section:
- Edit and change this section to:
- Locate the registry entry:
- Delete the third parameter provided to the SharedSection variable, i.e. replace “1024,3072,512” with “1024,3072” in the above example.
If Hello World is not working, check the webMathematica.log file in the logs subdirectory of the tomcat installation directory for error messages.
Common possible issue:
Search the log file for error
....com.wolfram.kerneltools.state.StateMachine . 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.4.2 was released for Mathematica 11.2 and looks in the default installation directory of Mathematica for the executable.
To point to the correctly paired version of Mathematica, configure webMathematica.
Note: These instructions assume Mathematica 11.x was installed to
C:Program FilesWolfram ResearchMathematica11.x. If you have a different installation directory, substitute the installation directory you used.
From the webMathematica base webpage, select the Plot Example. When the page opens, click the Plot button.
On certain systems, a
FrontEndError: ExportString failed: -Graphics- error may appear instead of the plot. This may indicate that the Mathematica front end did not launch.
Windows limits the amount of memory allocated to non-interactive users, such as Mathematica kernels launched by the Tomcat server. When such kernels need to perform a calculation that requires the Mathematica front end, the memory allocation setting may prevent the launching of the front end.
To increase the available memory, allow non-interactive users to use the same amount of memory as interactive users.