Q: How do I get Tomcat to recognise the data_dir?
A: All you have to do to get Tomcat to recognise the environment variable is create a file called setenv.sh for unix or setenv.bat for windows and save it in your Tomcat/bin directory. It will be sourced by catalina.sh if it exists.
Then, add the lines:
Linux:
#!/bin/sh
CATALINA_OPTS="-DGEOSERVER_DATA_DIR=/path/to/my/geoserver/data/directory"
export CATALINA_OPTS
Windows:
set CATALINA_OPTS="-DGEOSERVER_DATA_DIR=C:\path\to\my\geoserver\data\directory"
You can also add some other optional options:
Linux:
#!/bin/sh
CATALINA_OPTS=" \
-Xms64m -Xmx1024m \
-XX:PermSize=32m -XX:MaxPermSize=128m \
-server \
-Djava.awt.headless=true \
-DGEOSERVER_DATA_DIR=/path/to/my/geoserver/data/directory"
export CATALINA_OPTS
Windows XP:
set CATALINA_OPTS= ^
-Xms64m -Xmx1024m ^
-XX:PermSize=32m -XX:MaxPermSize=128m ^
-server ^
-Djava.awt.headless=true ^
-DGEOSERVER_DATA_DIR="/path/to/my/geoserver/data/directory"