How to increase Tomcat Heap Size (JVM Heap size) in Windows ?

tomcat

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:

Go to catalina.bat, catalina.bat is present in bin folder of your Tomcat Directory, and set this.


set JAVA_OPTS=-Xms128m -Xmx192m
Share on Google Plus

About JK STACK

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.

6 comments:

  1. Thanks a Lot it worked .....! :)

    ReplyDelete
  2. thanks it is increased but i need one more help like used % is becoming high upto 99% in Survivor Space and Eden Space due to this tomcat not running

    ReplyDelete
  3. while running tomcat7.0 it getting the nullpointer exeception continiously can any one give the guide lines how to sort out this problem

    ReplyDelete
  4. how to increase the Tenured Gen and Code Cache,Perm Gen [shared-ro],Perm Gen [shared-rw] these memory pl z guide me how can we increase the size in tomcat7.0 using jdk7

    ReplyDelete
  5. Thanks for this...
    Actually many more things i learn form this site..
    keep update this site..

    ReplyDelete