Meaningless Drivel is fun!*
The moose likes Tomcat and the fly likes How do you set mutliple memory parameters in Catalina.bat? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "How do you set mutliple memory parameters in Catalina.bat?" Watch "How do you set mutliple memory parameters in Catalina.bat?" New topic
Author

How do you set mutliple memory parameters in Catalina.bat?

Jerry Haines
Greenhorn

Joined: May 31, 2010
Posts: 2
I have been trying to get the Memory parameters set in Catalina.bat for Tomcat starting in a command window.

I need a start of -Xms1536m -Xmx2048m.

I am able to use the Set JAVA_OPTS= -Xms1536m to pass one parameter, which works and Tomcat starts my WAR files.

When I try two parameters at the same time, I get heap errors and unpredicable responses.

Below are several different attempts that did not work.

I am using Vista with 4G of RAM.

rem set JAVA_OPTS = '-Xms1536m -Xmx2048m' did not work
rem SET JAVA_OPTS = '-Xmn1536m -Xmx2048m' did not work
rem set JAVA_OPTS='-Xms1536m -Xmx2048m' did not work
rem set JAVA_OPTS= '-Xms1536m' did not work
rem set JAVA_OPTS='Xms1536m' did not work

set JAVA_OPTS=-Xms1536m

rem set JAVA_OPTS=-Xms1536m This one works to start web services on 2010-05-31


Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19651
    
  18

Moving to our Tomcat forum.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15952
    
  19

Try using double-quotes instead of single quotes. That is:



Customer surveys are for companies who didn't pay proper attention to begin with.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12760
    
    5
Is this a Vista thing? I have used



in catalina.bat for Windows XP for years.

Bill
Jerry Haines
Greenhorn

Joined: May 31, 2010
Posts: 2
Thank you each for your reply.

They were helpful in the trouble shooting. It turns out that single quotes or double quotes are not the solution. However, when testing I got the message during shutdown of a startup - - Incompatible initial and maximum heap sizes specified.

As I continued to trouble shoot this I found the following website and notes.

website http://javahowto.blogspot.com/2006/06/6-common-errors-in-setting-java-heap.html

• Only setting -Xms JVM option and its value is greater than the default maximum heap size, which is 64m. The default minimum heap size seems to be 0. For example,
java -Xms128m BigApp
Error occurred during initialization of VM
Incompatible initial and maximum heap sizes specified
The correct command should be java -Xms128m -Xmx128m BigApp. It's a good idea to set the minimum and maximum heap size to the same value. In any case, don't let the minimum heap size exceed the maximum heap size.


I then experimented with multiple combination and discovered that for this Vista with 4 G of RAM that when I exceed 1536m the tomcat server will not start or will crash with heap errors.
My working solution was to set the JAVA_OPTS= -Xms1536m -Xmx1536m. This repeatly worked. No single quotes or double quotes. Quotes or double quotes also caused errors.

When I moved 1536 to 2048 then the tomcat server would not start.

Again thank you all.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How do you set mutliple memory parameters in Catalina.bat?
 
Similar Threads
JBoss run.bat not launching not showing any errors just going to next line in the command prompt
Java Heap Space
Launching tomcat with additional VM parameters
java.lang.OutOfMemoryError: Java heap space
out of memory exception in web application!