Configuring Tomcat's Java Heap Size

In this tutorial you will use a GUI utility that ships with Tomcat to configure Java options. This tutorial uses Tomcat6, but the techniques should be the same for newer releases.

Tomcat running as a Windows Service

Locate and copy the location of tomcat6w.exe (if using Tomcat7, this will be named tomcat7w)

  1. Open and navigate through directory windows as shown in the screen shot below.
  2. Right-click the directory path bar and click Copy address as text.
  3. The clipboard should contain a string such as C:\Program Files\jasperreports-server-4.5.1\apache-tomcat\bin.

Locate the Tomcat bin directoryOpen a command line window with Administrator privileges

  1. From the Start menu, enter "command" in the Search programs and files box.
  2. From the list of files, right-click "Command Prompt" and choose Run as administrator.

Run the command prompt as AdministratorChange directories - Tomcat's bin directoryRun the tomcat6w application Run the Tomcat service admin utility

  1. In the command box, type "cd" (to change directories) then right-click to paste the path to the Tomcat bin directory. Press return. 
  2. Now in the Tomcat bin directory, type "tomcat6w //ES//jasperreportsTomcat" and press return.
  3. Click the Java tab. Edit the values in the Java Options box. The following settings allocate 2 GB memory to the start Java heap, 6 GB for the maximum heap size, 128 MB for the permgen space and 256 MB for the maximum permgen size.

    Change the Java heap settings in the Java Options box

    The following settings allocate 2 GB memory to the start Java heap, 6 GB for the maximum heap size, 128 MB for the permgen space and 256 MB for the maximum permgen size.

    -Xmx2048M
    -Xmx6144M
     
    other settings, e.g. thread stack, directory license location etc
     
    -XX:PermSize=128m
    -XX:MaxPermSize=256m
  4. Click OK to close the applet.
  5. Restart the Tomcat service (from the Start menu, you can navigate to JasperReports Server > Start or Stop Services).

Quick Reference

 

Feedback