World Map
Java Service Wrapper is the easiest way to make your product more reliable.
  • Free Trial
  • Buy Now
wrapper.java.additional.<n> Property

Index

wrapper.java.additional.<n>

Compatibility : 1.0.0
Editions :Professional EditionStandard EditionCommunity Edition
Platforms :WindowsMac OSXLinuxIBM AIXFreeBSDHP-UXSolarisIBM z/OSIBM 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

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 include a dynamically generated configuration file which contains the dynamic property definitions. The second option is to make use of the wrapper.java.additional_file property to make use of a parameter list stored directly in a file.

Special case of the Java options that require arguments

Java 9 introduces several options (such as --module-path or --add-modules) that require to be specified with an argument. Usually the argument is separated from the option name by a space, but any space inside values of the wrapper.java.additional.<n> properties is interpreted as part of the argument value and not as delimiter. A solution is to separate the option name and the argument by an equal sign (=) instead of a space.

wrapper.java.additional.1=--add-modules=MODULE1,MODULE2

Note that this will only work with long options (those starting with '--') and not with their short aliases. For example, '-p=<PATH>' is not allowed ('-p' being an alias of '--module-path').

Another solution, which allows you to use both spaces and short aliases, is to use the JDK_JAVA_OPTIONS environment variable. The content of this variable will be added to the options of the command line by the JVM. You can set it from the Wrapper configuration file by using the following syntax:

set.JDK_JAVA_OPTIONS=--add-modules MODULE1,MODULE2

Note however that you will not be able to visualize the content of JDK_JAVA_OPTIONS when printing the Java command line (using the wrapper.java.command.loglevel property) as it is only parsed by the JVM when it is launched.

You can read more information about the long options and the JDK_JAVA_OPTIONS variable on Oracle's website.

wrapper.java.additional.<n>.stripquotes

Compatibility : 1.0.0
Editions :Professional EditionStandard EditionCommunity Edition
Platforms :Windows (Not Supported)Mac OSXLinuxIBM AIXFreeBSDHP-UXSolarisIBM z/OSIBM 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/OSIBM 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_file

Compatibility :3.5.16
Editions :Professional EditionStandard EditionCommunity Edition
Platforms :WindowsMac OSXLinuxIBM AIXFreeBSDHP-UXSolarisIBM z/OSIBM 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.

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.stripquotes

Compatibility :3.5.16
Editions :Professional EditionStandard EditionCommunity Edition
Platforms :WindowsMac OSXLinuxIBM AIXFreeBSDHP-UXSolarisIBM z/OSIBM 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. To be consistent with the way the wrapper.java.additional.<n>.stripquotes property works, this property defaults to the value of the wrapper.java.additional.default.stripquotes property, which itself defaults to "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 Visual VM 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.