Search code examples
tomcatremote-debuggingsystem-properties

Run Tomcat in debugging mode with system properties


I am trying to run tomcat in debuging mode. In the startup I want to add also some system properties, but I could not achieve this. I am running :

    ./catalina.sh jpda run -Dtest.variable="value"

and when I try to access the value of the variable, I get always null:

    System.out.println(null == System.getProperty(test.variable)); //prints always true

Does somebody know any solution for this problem? Thank you!


Solution

  • I have never tried passing system variables to catalina.sh and I don't know if it works. You want to try setting the JAVA_OPTS environment variable in $CATALINA_HOME/bin/setenv.sh

    export JAVA_OPTS="-Dtest.variable="value""