Index

wrapper.java.additional.<n>

Compatibility :1.0.0
Editions :Professional EditionStandard EditionCommunity Edition
Platforms :WindowsMac OSXLinuxIBM AIXFreeBSDHP-UXSolarisIBM z/Linux

Additional Java parameters to pass to Java when it is launched. These are not parameters for your application, but rather parameters for the JVM.

<n> component:

Each element has a property name which starts with "wrapper.java.additional." and the "<n>" component of the property name is an integer number counting up from "1". By default, the numbering should be in sequence without gaps. The wrapper.ignore_sequence_gaps property can optionally be set to allow gaps in the sequence.

Example:
wrapper.java.additional.1=-server
wrapper.java.additional.2=-Dprop=TRUE

It is important that each property only define a single argument to the JVM. If the value needs to include a space, then it is necessary to add quotes following the rules described below.

Example (Incorrect):
wrapper.java.additional.1=-server -Dprop=TRUE

NOTE

For application-specific properties, especially those with values containing sensitive data, consider using wrapper.app.properties.<n>.

NOTE

When the wrapper.java.detect_debug_jvm property is set to TRUE, if one of wrapper.java.additional.<n> properties is set to "-Xdebug", then the Wrapper will consider that the JVM is using a debugger and ignore certain timeouts.

If you wish to dynamically change the list of additional Java parameters, there are a few ways to do so. The first is to make use of cascading include files to append a generated configuration file listing the wrapper.java.additional.<n> properties along with your JVM options. Alternatively, you may use the wrapper.java.additional_file property to reference a parameter file where you would simply list the JVM options without properties. Finally, you can pass wrapper.java.additional.<n> as command line properties when launching the Wrapper.

wrapper.java.additional.<n>.stripquotes

Compatibility :1.0.0
Editions :Professional EditionStandard EditionCommunity Edition
Platforms :Windows (Not Supported)Mac OSXLinuxIBM AIXFreeBSDHP-UXSolarisIBM z/Linux

If a wrapper.java.additional.<n> value contains quotes, then the contents of the quotes will be passed to the JVM as a single argument on Windows. However on UNIX, the quotes will also be included as part of the argument value. In most cases, this is not correct behavior on UNIX, but it is this way to maintain backwards compatibility.

The wrapper.java.additional.<n>.stripquotes property makes it possible to tell the Wrapper to automatically strip those extra quotes on UNIX. The property is ignored on Windows.

Defaults to the value of the wrapper.java.additional.default.stripquotes property, which itself defaults to "FALSE".

<n> component:

Each element has a property name which starts with "wrapper.java.additional." and the "<n>" component of the property name is an integer number counting up from "1". By default the numbering should be in sequence without gaps". The wrapper.ignore_sequence_gaps property can optionally be set to allow gaps in the sequence.

Example:
wrapper.java.additional.1.stripquotes=FALSE

The following replacements will be made when stripping quotes. All other characters will remain unchanged.

  • '\\' will become '\',
  • '\"' will become '"'
  • '"' will become ''
Example:
wrapper.java.additional.1=-server
wrapper.java.additional.2=-Dprop=TRUE
wrapper.java.additional.3=-Dmyapp.data="../MyApp Home"
wrapper.java.additional.3.stripquotes=TRUE

wrapper.java.additional.default.stripquotes

Compatibility :3.5.17
Editions :Professional EditionStandard EditionCommunity Edition
Platforms :Windows (Not Supported)Mac OSXLinuxIBM AIXFreeBSDHP-UXSolarisIBM z/Linux

Makes it possible to change the default strip quotes behavior on UNIX when you wish to have the same behavior for all wrapper.java.additional.<n> property values. The default value is "FALSE". The property is ignored on Windows.

Example:
wrapper.java.additional.default.stripquotes=FALSE

wrapper.java.additional.<n>.java_version.min

Compatibility :3.5.36
Editions :Professional EditionStandard EditionCommunity Edition (Not Supported)
Platforms :WindowsMac OSXLinuxIBM AIXFreeBSDHP-UXSolarisIBM z/Linux

This property can be used to append the option with index 'n' only if the Java version is greater than or equal to the specified value.

The default value is '1.4' which is the oldest JVM version supported by the Wrapper. Any lower value is invalid and will cause the Wrapper to stop.

The value can be in the format '1.major[.minor[_revision]]' or 'major[.minor[.revision]]', regardless the version of Java. This is done to support both numbering schemes returned by 'java -version': prior to Java 9 the first format was used, while Java 9 and above use the second format.

The brackets indicate that the minor and revision components are optional. Leaving one or both unspecified means that these placeholders will accept any number.

Option with index 'n' is ignored for any Java version lower than 1.7:
wrapper.java.additional.<n>.java_version.min=1.7
Option with index 'n' is ignored for any Java version lower than 8.0.40:
wrapper.java.additional.<n>.java_version.min=8.0.40

WARNING

wrapper.java.additional.<n>.java_version.max

Compatibility :3.5.36
Editions :Professional EditionStandard EditionCommunity Edition (Not Supported)
Platforms :WindowsMac OSXLinuxIBM AIXFreeBSDHP-UXSolarisIBM z/Linux

This property can be used to append the option with index 'n' only if the Java version is lower than or equal to the specified value.

The default value is 'UNLIMITED'.

The value can be in the format '1.major[.minor[_revision]]' or 'major[.minor[.revision]]', regardless the version of Java. This is done to support both numbering schemes returned by 'java -version': prior to Java 9 the first format was used, while Java 9 and above use the second format.

The brackets indicate that the minor and revision components are optional. Leaving one or both unspecified means that these placeholders will accept any number.

Option with index 'n' is ignored for any Java version greater than 9.0.1:
wrapper.java.additional.<n>.java_version.max=9.0.1
Option with index 'n' is ignored for any Java version greater than 9:
wrapper.java.additional.<n>.java_version.max=9

WARNING

wrapper.java.additional.<n>.app_only

Compatibility :3.5.57, Requires Java 9+ (Deprecated as of 3.5.60)
Editions :Professional EditionStandard EditionCommunity Edition
Platforms :WindowsMac OSXLinuxIBM AIXFreeBSDHP-UXSolarisIBM z/Linux

WARNING

Use of this property has been deprecated as of Wrapper version 3.5.60 in favor of the wrapper.java.additional.<n>.scope property.

Before launching a JVM to run the Java application, the Wrapper will execute the Java command line with a --dry-run option to check that the command line is valid.

The wrapper.java.additional.<n>.app_only property can be set to TRUE to skip an option for the "--dry-run" command line.

This property has no effect when using versions of Java that do not support the --dry-run option (prior to Java 9).

The default value is "FALSE", which means that the specified option will be present in both the real Java command line and the "--dry-run" command line. In the vast majority of cases, FALSE is preferred so that all JVM options are verified.

NOTE

Setting this property to TRUE will bypass the validity check for the specified option.

There are a few cases where setting wrapper.java.additional.<n>.app_only to TRUE can be useful, though. For example, using the -XX:NativeMemoryTracking=[off|summary|detail] option to track native memory in JVMs will cause a warning when used in the --dry-run command line:

OpenJDK 64-Bit Server VM warning: Native Memory Tracking did not setup properly, using wrong launcher?

Most of the time, this warning won't be visible because the output will be logged at the level specified with the wrapper.java.query.loglevel property, which is DEBUG by default. However, it is not possible to track the native memory usage of a "--dry-run" JVM anyway because it won't run user's native code. It is therefore best not to include this option in the "--dry-run" command line.

Example (enable -XX:NativeMemoryTracking only when running the application):
wrapper.java.additional.4=-XX:NativeMemoryTracking=summary
wrapper.java.additional.4.app_only=TRUE

wrapper.java.additional.<n>.scope

Compatibility :3.5.60
Editions :Professional EditionStandard EditionCommunity Edition
Platforms :WindowsMac OSXLinuxIBM AIXFreeBSDHP-UXSolarisIBM z/Linux

WARNING

DO NOT modify any of these parameters unless you have read this property description. Incorrect settings can cause the Wrapper to fail to operate as expected.

Before launching the Java application, the Wrapper will run the java command a few times to determine the characteristics of the current Java installation and the appropriate settings for the application. In most cases, the command lines for these Java invocations are built by the Wrapper without the user having to worry about it. In a few rare scenarios, however, it may be necessary to add or remove certain options to these command lines. Let's first draw the list of these Java invocations and their roles:

  • java --version: This invocation retrieves information about the current Java installation (version, vendor, etc.). It only uses the --version parameter, no additional options are needed.

  • Call to the WrapperBootstrap class: This invocation retrieves information about the Java Application (main module, main class, package, etc). The Wrapper will build the command line with its own options and parameters. In particular, the classpath, module path and list of modules must exactly match those of the command used when launching the application. In a few rare cases, some additional arguments may be added by the user in order to load the main class.

  • Call with the --dry-run option: The --dry-run option was introduced in Java 9, therefore this invocation is not performed on earlier Java versions. This call is used to validate the Java command line right before executing the application. The command line is essentially the one used when launching the application with the addition of the --dry-run option which specifies that the main method should not be executed.

    In some rare cases, one might want to remove certain options that are not relevant in the dry run context. For example, using the -XX:NativeMemoryTracking=[off|summary|detail] option to track native memory in JVMs will cause a warning when used in the --dry-run command line:

    OpenJDK 64-Bit Server VM warning: Native Memory Tracking did not setup properly, using wrong launcher?
    

    Most of the time, this warning won't be visible because the output will be logged at the level specified with the wrapper.java.query.loglevel property, which is DEBUG by default. However, it is not possible to track the native memory usage of a "--dry-run" JVM anyway because it won't run user's native code. It is therefore best not to include this option in the "--dry-run" command line.

The wrapper.java.additional.<n>.scope property controls in which command line(s) the parameter with index 'n' should be referenced.

Possible values are:

  • DRYRUN_APP: to pass the parameter to both the --dry-run instance and the application. This value is suitable to the vast majority of cases.

  • APP: to only pass the parameter to the application.

  • BOOTSTRAP_DRYRUN_APP: to pass the parameter to the bootstrap instance, the --dry-run instance and the application.

The default value is DRYRUN_APP.

Example:
# The following option is used for the --dry-run and application calls:
wrapper.java.additional.1=-Xmx1g
wrapper.java.additional.1.scope=DRYRUN_APP

# The following option is only for the application:
wrapper.java.additional.2=-agentlib:mylib
wrapper.java.additional.2.scope=BOOTSTRAP_DRYRUN_APP

# The following option is used for the --dry-run, bootstrap and Application calls:
wrapper.java.additional.3=-XX:NativeMemoryTracking=summary
wrapper.java.additional.3.scope=APP

wrapper.java.additional_file

Compatibility :3.5.16
Editions :Professional EditionStandard EditionCommunity Edition
Platforms :WindowsMac OSXLinuxIBM AIXFreeBSDHP-UXSolarisIBM z/Linux

In certain cases, it can be inconvenient to list up your Java parameters in the Wrapper configuration file. This property provides a way to specify a file which can contain one or more parameters that will be passed as is to the JVM when it is launched. This can be very useful when the parameter list needs to be generated dynamically or via an installer.

Any parameters defined in this file will appear after those defined using the standard wrapper.java.additional.<n> properties.

Starting with Wrapper version 3.5.23, any environment variable references in the file will be expanded.

NOTE

You may target different versions of Java by including the WRAPPER_JAVA_VERSION environment variable in the name of the file.

Parameter File Format:

The file format is simple.

  • It must start with an encoding directive line just like the Wrapper configuration file. This is needed to tell the Wrapper what encoding to use when reading the file. If this line is missing, then the Wrapper will attempt to proceed after logging a warning. The encoding used in the file may be different from the encoding used in other configuration files.
  • Multiple parameters can be written in one line by separating each parameter with one or more spaces.
  • It is also possible to break the parameters into multiple lines.
  • The '#' character is interpreted as a comment character. To include a '#' character in a property value, the value must either be quoted ("#") or escaped by a second '#' character.
  • If any of the values need to include a space, then it is necessary to add quotes following the rules described below to make sure the file works consistently across all platforms.
Example of Parameter File UTF-8:
#encoding=UTF-8
# Example parameters: Multiple parameters in one line
-DTEST1=Value1 -DTEST2=Value2

# More parameters
-DTEST3=Value3

wrapper.java.additional_file.required

Compatibility :3.5.36
Editions :Professional EditionStandard EditionCommunity Edition
Platforms :WindowsMac OSXLinuxIBM AIXFreeBSDHP-UXSolarisIBM z/Linux

Specifies if the Java additional file is required or not. If it is required and not found, the Wrapper will stop without starting the JVM. If it is not required, the file will be ignored when not found.

The default value is TRUE.

Example:
wrapper.java.additional_file.required=FALSE

wrapper.java.additional_file.stripquotes

Compatibility :3.5.16
Editions :Professional EditionStandard EditionCommunity Edition
Platforms :Windows (Not Supported)Mac OSXLinuxIBM AIXFreeBSDHP-UXSolarisIBM z/Linux

Different platforms handle parameters with spaces differently. To make a given configuration work consistently, you should always quote those values. They will be used as is on Windows. However, on UNIX platforms, the quotes will be stripped as the command line is broken into a parameter list.

In almost all cases, you will want to strip these quotes. The default value is "FALSE".

Example:
wrapper.java.additional_file.stripquotes=FALSE
Example of Parameter File UTF-8:
#encoding=UTF-8
-DTEST1=Value1 -DTEST2="Test Value with spaces."

Usage Examples

Integration Methods

The pages below describe 4 different methods on how to integrate a Java application with the Java Service Wrapper. Each method is illustrated with an example which uses the wrapper.java.additional.<n> properties to configuring things like memory, class and library paths.

JMX Control

The wrapper.java.additional.<n> properties can also be used to configure monitoring tools like VisualVM or JConsole.

Java Max Memory Control

The Wrapper provides several properties to control the memory that the JVM will be allowed to use. These properties have their equivalents using the wrapper.java.additional.<n> properties. Please refer to the pages below for details.

Reference: Parameters