Search code examples
javatomcatjvmtomcat7

Set Heap Size in GB for Tomcat 7.0 in Windows Server 2012


I'm stuck at this problem for a long time without finding any solution.

I have the following Java Options in my Tomcat7_1w.exe:
(I don't have a setenv.bat or catalina.bat)

-Dcatalina.home=G:\Server\Tomcat_1
-Dcatalina.base=G:\Server\Tomcat_1
-Djava.endorsed.dirs=G:\Server\Tomcat_1\endorsed
-Djava.io.tmpdir=G:\Server\Tomcat_1\temp
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
-Djava.util.logging.config.file=G:\Server\Tomcat_1\conf\logging.properties
-XX:SoftRefLRUPolicyMSPerMB=3600
-XX:+UseParallelGC
-XX:NewRatio=2
-Dserver
-D64
-Xmx8g
-Xms2g

But I get the following error:

[2018-03-09 16:01:29] [error] [12196] CreateJavaVM Failed
[2018-03-09 16:01:29] [error] [12196] The system could not find the environment option that was entered.
[2018-03-09 16:01:29] [error] [ 1620] Failed to start Java
[2018-03-09 16:01:29] [error] [ 1620] ServiceStart returned 4

I tried -Xmx4g, -Xmx4G still the same error.

Options that work:

-Dcatalina.home=G:\Server\Tomcat_1
-Dcatalina.base=G:\Server\Tomcat_1
-Djava.endorsed.dirs=G:\Server\Tomcat_1\endorsed
-Djava.io.tmpdir=G:\Server\Tomcat_1\temp
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
-Djava.util.logging.config.file=G:\Server\Tomcat_1\conf\logging.properties
-XX:SoftRefLRUPolicyMSPerMB=3600
-XX:+UseParallelGC
-XX:NewRatio=2
-Dserver
-Xmx1024m
-Xms512m

Also, if I use the option -d64 (with small d), I get the same error. The capital D does not give an error.

What am I doing wrong?


Solution

  • Options -d32 and -d64 do not work on windows. You should select according bin folder with JRE (32 or 64 bit) in system PATH variable.