Wolfram Computation Meets Knowledge

How do I install web Mathematica on Windows?

Read this article in: Deutsch, Español, Français, 日本語, 한국어, Português, Русский, 中文


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:

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

Setting Up Java

Download and run the Java installer.

Setting Up Tomcat

Installation

Download and run the Tomcat installer. We recommend downloading the 32-bit/64-bit Windows Service Installer apache-tomcat-<version>.exe.

Testing Tomcat

  1. To start the Tomcat server, in the Start Menu under Apache Tomcat, open the Configure Tomcat application.
  2. Click the Start button.
  3. Open a web browser and submit “localhost:8080”. If Tomcat has been set up correctly, a page similar to the following one appears:
  4. 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.
  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.
  5. Enter “JAVA_HOME” as “Variable name” and the installation location of the Java JDK as “Variable value”.

  6. 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.

  1. To create the account, add a user.
  2. In the Start Menu under Apache Tomcat, open the Configure Tomcat application.

  3. To set the account information of the Tomcat server, select the Log On tab.

  4. Select “This account” and enter the account information.

  5. Click Apply to confirm the changes.
  6. To start the Tomcat server using the new account, return to the General tab.
  7. Click the Start button.

  8. Open a web browser and submit “localhost:8080”. If the user has been set up correctly, this Tomcat landing page appears again:
  9. Click OK to close the application.

 

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.

Installation

Follow the instructions for installing Mathematica on Windows.

Activation

Activate Mathematica using online or manual activation.
 

Making Licensing Files Accessible to web Mathematica

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.

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

Installation

  1. Download web Mathematica’s installation file from your User Portal.
  2. 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.
  3. Restart the Tomcat server in the Configure Tomcat application.

Testing and Troubleshooting

The web Mathematica 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 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.

    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:
      <KernelPool>
            <KernelPoolName>General</KernelPoolName>
            <URLPattern>/*</URLPattern>
      </KernelPool>
    3. Edit and change this section to:
      <KernelPool>
            <KernelPoolName>General</KernelPoolName>
            <KernelExecutable>
            C:\Program Files\Wolfram Research\Mathematica12.x\MathKernel
            </KernelExecutable>
            <URLPattern>/*</URLPattern>
      </KernelPool>
    4. 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.

    Testing the Front End

    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.

    1. 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 
    2. Delete the third parameter provided to the SharedSection variable, i.e. replace “1024,3072,512” with “1024,3072” in the above example.
    3. Restart the computer.
Is this article helpful?
Yes
No

Any comments?

Thank you for your feedback.

Submit

Contact Support

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)

Customer Support

Monday–Friday
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)

Monday–Thursday
8am–5pm US Central Time

Friday
8:30–10am & 11am–5pm US Central Time

  • Priority technical support
  • Product assistance from Wolfram experts
  • Help with Wolfram Language programming
  • Advanced installation support