How to Change JVM Xms and Xmx for Tomcat on Windows

Changing Tomcat’s initial (Xms) and maximum (Xmx) memory turns out to be counter-intuitive on Windows, especially when Tomcat is installed as a service. That’s because when running under a service on Windows, Tomcat does not read initial runtime configure files such as setenv.bat (or setenv.sh for Linux) and thus you cannot define variables there.

So the proper (and the easiest) way to change Xms and Xmx values for Tomcat under Windows is with the command tomcat7w.exe (for Tomcat 7) or tomcat8w.exe which are found in tomcat’s “bin” directory. When you run the command, you should see this window with options to change the JVM options along with Xmx and Xms:

java_properties_tomcat

Here’s a tricky part. If you have installed the Tomcat service under a custom name, you have to specify this custom name. Otherwise, you will get an error such as:

"The specified service does not exist as an installed service"

The trick to resolve this is to start tomcat7w.exe with an argument for the service name like this:

.\tomcat7w.exe \\ES\Name_of_service

If you are not sure what this name is, open Services (services.msc) and you will find the exact name of the service in the first tab (General) under Service name.

Comments

So empty here ... leave a comment!

Leave a Reply

Sidebar



%d bloggers like this: