JBoss.orgCommunity Documentation

Chapter 2. TorqueBox Installation

2.1. Distribution Variants
2.2. Getting Started Guide
2.3. Setting JVM Properties
2.4. Setting JRuby Properties

Starting with TorqueBox 3, there are two release distributions available:

For complete installation details and a walkthrough of creating sample applications please refer to the Getting Started Guide.

If using the torquebox command (Chapter 17, The torquebox Command), JVM properties can be set with the -J flag. The only caveat is hypens must be escaped with a "\".

For example:

$ torquebox run -J "\-Xmx2048m \-Djruby.jit.logging=true"

If using standalone.sh, just append the JVM properties to the end of the command.

For example:

$ $JBOSS_HOME/bin/standalone.sh -Djruby.jit.logging=true

If you'd prefer not to pass the JVM properties on the commandline, they can also be set in $JBOSS_HOME/bin/standalone.conf by appending to the JAVA_OPTS variable.

For example:

if [ "x$JAVA_OPTS" = "x" ]; then
   JAVA_OPTS="-Xms64m -Xmx512m -XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000"
   JAVA_OPTS="$JAVA_OPTS -Djboss.modules.system.pkgs=$JBOSS_MODULES_SYSTEM_PKGS -Djava.awt.headless=true"
   JAVA_OPTS="$JAVA_OPTS -Djboss.server.default.config=standalone.xml"
   echo "JAVA_OPTS already set in environment; overriding default settings with values: $JAVA_OPTS"

JAVA_OPTS="$JAVA_OPTS -Djruby.jit.logging=true"

You can also set the JAVA_OPTS environment variable directly in the shell, but if you do this make sure you copy the increased MaxPermSize from $JBOSS_HOME/bin/standalone.conf since if JAVA_OPTS is set in the shell the defaults in this file won't be applied.

For example:

$ export JAVA_OPTS="-Xmx1024m -XX:MaxPermSize=256m -Djruby.jit.logging=true"

While some JRuby properties can be set via torquebox.yml or torquebox.rb as shown in Section 5.2.4, “Ruby runtime configuration”, JRuby supports many more options than the ones TorqueBox exposes directly. As long as you are using the torquebox command (Chapter 17, The torquebox Command), you can set these other properties with the JRUBY_OPTS environment variable.

For example:

$ export JRUBY_OPTS="-X+C --1.9 -Xjit.logging=true"
$ torquebox run

If you are not using the torquebox command, JRUBY_OPTS can still be used for options like "--1.9", "--1.8", "-X+C", "+X-O", but not for options of the style "-Xa.b" like "-Xjit.logging=true". The latter options will need to be set as JVM properties (Section 2.3, “Setting JVM Properties”) by prefixing them with "jruby." like "-Djruby.jit.logging=true".

For example:

$ export JRUBY_OPTS="-X+C --1.9"
$ $JBOSS_HOME/bin/standalone.sh -Djruby.jit.logging=true