Setting Java Opts In Apache Tomcat

Setting Java Opts in the bin/catalina.(bat/sh) file can be used by your webserver to find files such as your applications property files.

 

Below is an example of increasing the memory size to hopefully avoid java out of memory errors. Also below, the location of property files is specified.

For windows the catalina.bat file should have the following line straight after the top comment section
set JAVA_OPTS=%JAVA_OPTS% -Xms512m -Xmx512m -XX:MaxPermSize=256m -Dcom.yourdomain.yourappname_1.properties=C:\workspaces\ws_4\application-one-name\properties\dev\prop.properties -Dcom.yourdomain.yourappname_2.properties=C:\workspaces\ws_4\application-two-name\properties\dev\prop.properties
For linux the catalina.bat file should have the following line straight after the top comment section
JAVA_OPTS=”$JAVA_OPTS -Xms512m -Xmx512m -XX:MaxPermSize=256mDcom.yourdomain.yourappname_1.properties=C:\workspaces\ws_4\application-one-name\properties\dev\prop.properties -Dcom.yourdomain.yourappname_2.properties=C:\workspaces\ws_4\application-two-name\properties\dev\prop.propertiess”

Note the quotes in the linux version as well as the absence of the word set.

apache-tomcat-environment

Lee Dixon, smug in the knowledge that his applications could find their properties files.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: