Q:

how to set JAVA_OPTS for Tomcat in Windows?

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.

A:

Apparently the correct form is without the ""
As in
set JAVA_OPTS=-Xms512M -Xmx1024M

A:

For Windows, in case the variable value has space(" ") in it, the correct way is actually to place quotes(") before the variable name like:
set "JAVA_OPTS=-Xms512M -Xmx1024M"

A:

Try 
set JAVA_OPTS=%JAVA_OPTS% -Xms512M -Xmx1024M

