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)
- Open and navigate through directory windows as shown in the screen shot below.
- Right-click the directory path bar and click Copy address as text.
- The clipboard should contain a string such as C:\Program Files\jasperreports-server-4.5.1\apache-tomcat\bin.
Open a command line window with Administrator privileges
- From the Start menu, enter “command” in the Search programs and files box.
- From the list of files, right-click “Command Prompt” and choose Run as administrator.
Run the tomcat6w application
- In the command box, type “cd” (to change directories) then right-click to paste the path to the Tomcat bin directory. Press return.
- Now in the Tomcat bin directory, type “tomcat6w //ES//jasperreportsTomcat” and press return.
-
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.
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
- Click OK to close the applet.
- Restart the Tomcat service (from the Start menu, you can navigate to JasperReports Server > Start or Stop Services).
Tomcat running in stand alone mode as an exe
When you get Java Heap memory related error java.lang.OutOfMemoryError. It is basically is JVM heap size problem. So for increasing the JVM Heap Size of Tomcat in Windows two way is there.
Method 1:
You have to create environment variable with name JAVA_OPTS and value -Xms256m -Xmx512m of course you can change the 256 and the 512 to whatever values you want. Here is the step by step process.
1. Right click on computer icon and click on properties.
2. Click on advanced system setting link.
3. Select the advanced tab.Here is the screen shot.
4. Click on Environment Variables button.
5. On system variables part :
– Click on new button.
– In the variable name, type : JAVA_OPTS
– In the variable value, type: -Xms256m -Xmx512m
– Click ok -> ok ->ok.
Now you have the environment variable JAVA_OPTS set to -Xms256m -Xmx512m.
Here -Xms256m (minimum of 256 MB)
-Xms512m (maximum of 512 MB)
Method 2:
set JAVA_OPTS=-Xms128m -Xmx192m
Method 3:
Create a new file setenv.bat in the bin folder and paste the following contants in it –
set JAVA_OPTS=-Xms128m -Xmx256m
Reblogged this on Dinesh Ram Kali..