how to set JAVA_OPTS for Tomcat in Windows?

wannabeartist picture wannabeartist · Feb 6, 2013 · Viewed 166.5k times · Source

I'm trying to set JAVA_OPTS for Tomcat on a Windows machine, but I keep getting an error if I add more than one variable.

For example, this works:

set JAVA_OPTS="-Xms512M"

But this does not:

set JAVA_OPTS="-Xms512M -Xmx1024M"

It results in the error:

Invalid initial heap size: -Xms512M -Xmx1024M
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

It's as if I can set one variable (-Xmx will also work) but not several.

I'm using the instructed setenv.bat file and my Tomcat is 7.0.35.

Answer

wannabeartist picture wannabeartist · Feb 6, 2013

Apparently the correct form is without the ""

As in

set JAVA_OPTS=-Xms512M -Xmx1024M