# Java (JVM) configuration

These DataSource configuration items define how the Java Virtual Machine (JVM) is set up to execute Java modules in DataSource applications.

Such modules include:

* Transformer Java modules, used in [Java-based Transformer Service blades](../deployment-framework/cdf-create-a-java-based-transformer-service-blade.md)
* Liberator’s Java Auth module, used in [Java-based Liberator Permissioning Service blades](../deployment-framework/cdf-create-a-java-based-liberator-permissioning-service-blade.md)
* The [JMX monitoring module](datasource-datasource-monitoring-and-management.md) used by all DataSource applications

The JVM configuration items aren’t available in Java-based DataSource applications; they’re only used in C-based DataSource applications that contain Java modules.

## jvm-global-classpath

`jvm-global-classpath` specifies the Java classpath to a Java module or modules.

You can specify multiple classpaths on the same line, using a space separator, like this:

```
jvm-global-classpath %r/lib/java/jmx-child-classloader.jar %r/lib/java/common-jmx.jar
```

You can also specify multiple classpaths, using a separate `jvm-global-classpath` item for each one; for example:

```
jvm-global-classpath %r/lib/java/jmx-child-classloader.jar
jvm-global-classpath %r/lib/java/common-jmx.jar
```

The classpath can contain the `%r` parameter; at run time, `%r` is replaced by the root directory ([application-root](datasource-run-time-environment-configuration.md#application-root)) under which the DataSource application runs, so you can define the classpath location relative to this.

You can also specify a classpath for a specific class, using the [classpath](#classpath) option of [add-javaclass](#add-javaclass).

**Use in**: C

**Syntax:** `jvm-global-classpath <classpath>`

**Type:** array of strings

**Default value:** `%r/lib/java`

## jvm-location

`jvm-location` specifies the location of the file containing the Java Virtual Machine. This location must be the complete (absolute) file path, including the name of the JVM file. For JVMs running on Linux, the filename is usually _libjvm.so_, for JVMs on Windows it’s _jvm.dll_

<dl><dt><strong>📌 NOTE</strong></dt><dd>

You should set up the location of the file containing the Java Virtual Machine for Liberator, Transformer and C-based Adapter blades by running the [Deployment Framework](../deployment-framework/index.md) command [`./dfw java`](../deployment-framework/cdf-the-deployment-framework-command-utility-dfw.md#java). See How can I.. [Configure a DataSource application’s JVM](datasource-configure-a-datasource-applications-jvm.md).

Don’t define `jvm-location` explicity for these components and blades.
</dd></dl>

**Use in**: C

**Syntax:** `jvm-location <absolute-file-path-and-JVM-filename>`

**Type:** string

**Default value:** +[none]+

## jvm-options

`jvm-options` specifies startup options for the Java Virtual Machine. You can specify any of the valid [Java command line options](https://docs.oracle.com/javase/7/docs/technotes/tools/windows/java.html).

You can put multiple options in one instance of `jvm-options`, for example:

```
#
# Specify JVM heap size.
#
jvm-options -Xms256m -Xmx256m
```

Or, for convenience, you can spread the options across multiple instances of `jvm-options`, for example:

```
#
# Specify JVM heap size.
#
jvm-options -Xms256m 
jvm-options -Xmx256m
```

**Use in**: C

**Syntax:** `jvm-options <java-command-line-options>`

**Type:** array of strings

**Default value:** +[none]+

## add-javaclass

`add-javaclass` specifies a Java class that implements a Java module used by the DataSource application. This configuration item is mainly used to specify the Java modules used within Liberator and Transformer; in particular, you use it to specify the Java module(s) of a Transformer Service blade (see [blade types](../deployment-framework/cdf-blade-types.md)).

For examples of how to use `add-javaclass` within Caplin Platform blades, see:

* How can I ... [Create a Java-based Transformer Service blade](../deployment-framework/cdf-create-a-java-based-transformer-service-blade.md)
* How can I ... [Create a Java-based Liberator Permissioning Service blade](../deployment-framework/cdf-create-a-java-based-liberator-permissioning-service-blade.md)
* How can I ... [Add a custom subject mapper to a Permissioning Service blade](../deployment-framework/cdf-add-a-custom-subject-mapper-to-a-permissioning-service-blade.md)

**Use in**: C

**Syntax:**

```
add-javaclass
   xref:class-id[class-id]   [string]
   xref:class-name[class-name] [string]
   xref:classpath[classpath]  [array of strings]
end-javaclass
```

| Option | Type | Default | Description |
| --- | --- | --- | --- |
| `<a name="class-id"></a>class-id` | string | +[none]+ | A short identifier of the Java class. When the Java module is part of a [Java-based Transformer Service blade](../deployment-framework/cdf-create-a-java-based-transformer-service-blade.md), `class-id` must be set to the blade name. |
| `<a name="class-name"></a>class-name` | string | +[none]+ | The fully-qualified class name of the Java module to load. |
| `<a name="classpath"></a>classpath` | array of strings | +[none]+ | One or more space-separated Java classpaths that define where the class in [class-name](#class-name) is to be loaded from; for example: `classpath %r/lib/java/jmx-child-classloader.jar %r/lib/java/common-jmx.jarclasspath` You can have multiple occurrences of `classpath` in the same `add-javaclass` item; for example: |
```
classpath %r/lib/java/jmx-child-classloader.jar
			classpath %r/lib/java/common-jmx.jar
```

---

**See also:**

* How can I... [Configure a DataSource application’s JVM](datasource-configure-a-datasource-applications-jvm.md)
* How can I... [Change the size of the JVM heap](datasource-change-the-size-of-the-jvm-heap.md)
