passing custom parameters to java when starting tomcat ?

Matthew Seaman m.seaman at
Fri Jun 10 15:42:04 GMT 2005

On Fri, Jun 10, 2005 at 06:42:12PM +0600, Ilia Chipitsine wrote:

> I tried to investigate supplied tomcat50ctl script, but I couldn't find
> where I add "-Djava.awt.headless=true" to java machine command line 
> options. Can anyone help me ?

tomcat50ctl isn't actually a script.  It's a setuid binary.  Which is
good in the sense that it allows you to control tomcat without needing
root access to a box, but inflexible when it comes to modifying the
Java command line.

When I ran into the problem you're seeing I ended up modifying the
Makefile in the www/jakarta-tomcat5 port so that my custom arguments
got compiled into the tomcat50ctl program.  This diff probably isn't
exactly what you need, but it should show you the idea:

caernarvon:...ports/www/jakarta-tomcat5:% diff -u Makefile.orig Makefile 
--- Makefile.orig       Thu Mar  3 13:22:56 2005
+++ Makefile    Thu Mar  3 14:05:51 2005
@@ -136,7 +136,7 @@
        @${ECHO_MSG} -n ">> Compiling and installing control program..."
        @${SED} \
-       -e "/%%JAVA_ARGS%%/s//\"-Dcatalina.home=${APP_HOME:S/\//\\\//g}\",/g" \
+       -e "/%%JAVA_ARGS%%/s//\"-server\", \"-Xmx1500m\", \"-Djava.awt.headless=true\", \"-Dcatalina.home=${APP_HOME:S/\//\\\//g}\",/g" \
        -e "/%%JAR_ARGS%%/s//\"start\",/g" \
        ${WRKDIR}/daemonctl.c > ${WRKDIR}/daemonctl_.c
        @cd ${WRKDIR} && ${CC} -ansi -o ${CONTROL_SCRIPT_NAME} daemonctl_.c

Alternatively, you can modify the
/usr/local/etc/rc.d/ script to use the standard
$CATALINA_HOME/bin/ and other similar scripts to stop and
start the server, which will permit you to set various environment
variables to achieve the effect you want.

Plans are afoot to produce an enhanced tomcatNNctl program: search the
archives of the freebsd-java at ... mailing list for more information.



Dr Matthew J Seaman MA, D.Phil.                       8 Dane Court Manor
                                                      School Rd
PGP:         Tilmanstone
Tel: +44 1304 617253                                  Kent, CT14 0JL UK
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 305 bytes
Desc: not available
Url :

More information about the freebsd-questions mailing list