web Mathematica requires that Java, a Servlet container and Mathematica are installed on your system. This guide walks you through the following steps to get web Mathematica installed and running on Windows:
- Setting Up Java
- Setting Up Tomcat
- Setting Up Mathematica
- Making Licensing Files Accessible to web Mathematica
- Installing and Setting Up web Mathematica
- Testing the Front End
Download and run the Java installer.
Download and run the Tomcat installer. We recommend downloading the 32-bit/64-bit Windows Service Installer apache-tomcat-<version>.exe.
- To start the Tomcat server, in the Start Menu under Apache Tomcat, open the Configure Tomcat application.
- Click the Start button.
- Open a web browser and submit “localhost:8080”. If Tomcat has been set up correctly, a page similar to the following one appears:
- To shut down the Tomcat server for now, click the Stop button:
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.
Creating a Tomcat Account (Recommended)
It is recommended that you set up a dedicated user account to run the Tomcat server, typically called “tomcat”. This account needs the permissions to run the Tomcat server.
- To create the account, add a user.
- 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 using the new account, return to the General tab.
- Click the Start button.
- Open a web browser and submit “localhost:8080”. If the user has been set up correctly, this Tomcat landing page appears again:
- Click OK to close the application.
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 web Mathematica, 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.
- Download web Mathematica’s installation file from your User Portal.
- Extract it into the “webapps” subdirectory of the Tomcat installation directory, which is typically at
C:\Program Files (x86)\Apache Software Foundation\Tomcat 8.5.
- Restart the Tomcat server in the Configure Tomcat application.
Testing and Troubleshooting
The web Mathematica 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:
<KernelPool> <KernelPoolName>General</KernelPoolName> <URLPattern>/*</URLPattern> </KernelPool>
- Edit and change this section to:
<KernelPool> <KernelPoolName>General</KernelPoolName> <KernelExecutable> C:\Program Files\Wolfram Research\Mathematica12.x\MathKernel </KernelExecutable> <URLPattern>/*</URLPattern> </KernelPool>
- Locate the registry entry:
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager \SubSystems\Windows %SystemRoot%system32csrss.exe ObjectDirectory=Windows SharedSection=1024,3072,512 Windows=On SubSystemType=Windows ServerDll=basesrv,1 ServerDll=winsrv:UserServerDllInitialization,3 ServerDll=winsrv:ConServerDllInitialization,2 ProfileControl=Off MaxRequestThreads=16
- Delete the third parameter provided to the SharedSection variable, i.e. replace “1024,3072,512” with “1024,3072” in the above example.
- Restart the computer.
If Hello World is not working, check the web Mathematica.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 [ERROR] Could not find MathLink executable. In such a case, web Mathematica could not find the executable of the Mathematica kernel. This can occur if you have installed Mathematica in a non-standard location or if your web Mathematica is not paired with its recommended Mathematica version, e.g. web Mathematica 3.5.3 with Mathematica 12.3. For the recommended pairings of other currently supported product versions, see here.
To point to the correctly paired version of Mathematica, configure web Mathematica.
Note: These instructions assume Mathematica 12.x was installed to
C:\Program Files\Wolfram Research\Mathematica12.x\MathKernel. If you have a different installation directory, substitute the installation directory you used.
From the web Mathematica 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.
Whether you have a question about billing, activation or something more technical, we are ready to help you.
1-800-WOLFRAM (+1-217-398-0700 for international callers)
8am–5pm US Central Time
- Product registration or activation
- Pre-sales information and ordering
- Help with installation and first launch
Advanced Technical Support (for eligible customers)
8am–5pm US Central Time
8:30–10am & 11am–5pm US Central Time
- Priority technical support
- Product assistance from Wolfram experts
- Help with Wolfram Language programming
- Advanced installation support