Configuring JVM options for UNIX

The location of the configuration file in Unix is “${JBOSS_HOME}/bin/standalone.conf”. Edit this file to add, delete, or change JVM options. The recommended way is as follows:

  1. Uncomment the “#PRESERVE_JAVA_OPTS=true” line by removing the hash character:

    # Uncomment the following line to prevent manipulation of JVM options

    # by shell scripts.

    #

    PRESERVE_JAVA_OPTS=true

  2. Define the options after the line with the condition:

    if [ "x$JAVA_OPTS" = "x" ]; then

    This section can contain many lines with references to the JAVA_OPTS variable.

    • The environment variable JAVA_OPTS must not be defined outside of the script, otherwise the script does not set any options!

    • For related information and actually recommended values see Settings on the application server. The values in the example do not necessarily reflect the recommendations. The correct settings also depend on further conditions like the actually used JDK version.

    #

    # Specify options to pass to the Java VM.

    #

    if [ "x$JAVA_OPTS" = "x" ]; then

       JAVA_OPTS="-Xms4096m -Xmx4096m -XX:MetaspaceSize=96M"

       JAVA_OPTS="$JAVA_OPTS -XX:MaxMetaspaceSize=512m"

       JAVA_OPTS="$JAVA_OPTS -Djboss.modules.system.pkgs=$JBOSS_MODULES_SYSTEM_PKGS"

       JAVA_OPTS="$JAVA_OPTS -Djava.awt.headless=true"

    else

       echo "JAVA_OPTS already set in environment; overriding default settings with values: $JAVA_OPTS"

    fi