How can I pass a property which has spaces using JAVA_OPTS
to Apache Tomcat?
For example;
-Dmy.property="How are you"
My operating system is SUSE Linux.
I actually figured this out using AWS Elasticbeanstalk, which lets you have spaces in the Environment Properties you can enter via the UI.
As part of the build of the server instance, the Elasticbeanstalk service replaces the /usr/bin/tomcat7 script in order to accommodate some of its requirements.
If you check this, you can see the following difference:
Default script:
if [ "$1" = "start" ]; then
${JAVACMD} $JAVA_OPTS $CATALINA_OPTS \
Elasticbeanstalk script:
if [ "$1" = "start" ]; then
eval "${JAVACMD} $JAVA_OPTS $CATALINA_OPTS \
...."
ie they have placed an "eval" before the command to start the JVM, and enclosed the entire command in double-quotes.
This appears to allow the JAVA_OPTS values with spaces be preserved.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With