java.lang.OutOfMemoryError

my application when deployed in the production server throws this error, but this works fine in localhost.why is this so?the prod server is running on linux and tomcat
[188 byte] By [shuinia] at [2007-10-3 8:55:41]
# 1
i got this from googlingThrown when the Java Virtual Machine cannot allocate an object because it is out of memory, and no more memory could be made available by the garbage collector.but how can this be solved?
shuinia at 2007-7-15 4:05:51 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
i got this somewhere but it does not seem to workjava -Xms<initial heap size> -Xmx<maximum heap size>java -Xms32m -Xmx128mi am just executing it on the linux command line
shuinia at 2007-7-15 4:05:51 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
you must set it on the application server not on the machine
jgalacambraa at 2007-7-15 4:05:51 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4
what do you mean?can you be more specific?i googled it and everything gave me the syntax i posted above which does not seem to work
shuinia at 2007-7-15 4:05:51 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5

You need to put it in the startup script for the application server. The details depend on the server, In Tomcat 5.0, you will normally create a script like this:

@echo off

setlocal

set JAVA_OPTS=-Xms256m -Xmx256m

%TOMCAT_HOME%\bin\startup

endlocal

This one is for Windows. It sets additional parameters for the java call that starts Tomcat, and calls the bin/startup.bat that actually starts the server.

To see what parameters you can use, and how it works, have a look at the Tomcat bin/startup.bat and bin/catalina.bat.

For other appservers the process is similar: There is some mechanism for adding params to the appserver startup, find it and add your stuff.

johannefa at 2007-7-15 4:05:51 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...