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:

  1. Setting Up Java
  2. Setting Up Tomcat
  3. Setting Up Mathematica
  4. Making Licensing Files Accessible to the “Tomcat” User
  5. Installing and Setting Up webMathematica
  6. Testing the Front End


Setting Up Java

Download and run the Java installer.

Setting Up Tomcat


  1. 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.
  2. It is recommended that you create a user account to run the Tomcat server, typically called “tomcat”.
  3. In the Start Menu under Apache Tomcat, open the Configure Tomcat application.
  4. To set the account information of the Tomcat server, select the Log On tab.
  5. Select “This account” and enter the account information.
  6. Click Apply to confirm the changes.
  7. To start the Tomcat server, return to the General tab.
  8. Click the Start button.
  9. Click OK to close the application.

Testing Tomcat

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.
  1. Open the Control Panel and search for “System”.
  2. Click “Edit the system environment variables”. The System Properties dialog appears.

  3. Click the Environment Variables button.
  4. 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”.

  5. Click the OK button in either window to confirm and close the windows.


Setting Up Mathematica

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.


Activate Mathematica using online or manual activation.

Making Licensing Files Accessible to the “Tomcat” User

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.

  1. To identify the location of your mathpass file, evaluate in Mathematica:
  2. To identify the base directory location, evaluate:
  3. 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.


Installing and Setting Up webMathematica


  1. 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 Files\Apache Software Foundation\Tomcat 8.0.
  2. Restart the Tomcat server in the Configure Tomcat application.

Testing and Troubleshooting

The webMathematica package contains several test webpages.

  1. Point a browser to “localhost:8080/webMathematica”.
  2. Click the Hello World example.
  3. 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 [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.

    1. Open <Tomcat_Install>/webapps/webMathematica/WEB_INF/MSPConfiguration.xml in a text editor, where <Tomcat_Install> represents the Tomcat installation directory.
    2. Locate the following section:
    3. <KernelPool>
    4. Edit and change this section to:
            C:\Program Files\Wolfram Research\Mathematica\11.1\MathKernel
    5. Note: These instructions assume Mathematica 11.1 was installed to C:\Program Files\Wolfram Research\Mathematica\11.1. If you have a different installation directory, substitute the installation directory you used.

    Testing the Front End

    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.

    1. Locate the registry entry:
      HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\
      %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
    2. Delete the third parameter provided to the SharedSection variable, i.e. replace “1024,3072,512” with “1024,3072” in the above example.