Configuring the Java Version of a Custom Policy | MuleSoft Documentation
# Configuring the Java Version of a Custom Policy
Mule Gateway custom policies can support different Java versions. To upgrade your custom policy to a newer version of Java, ensure that all policy dependencies support the new Java version and add the new Java version to your policy’s implementation metadata YAML file.
After you upgrade the policy:
  1. Package the custom policy.
  2. Republish the custom policy to Exchange.
  3. Upgrade your applied policies to the new policy version.


## Before You Begin
Before upgrading the Java version of your policy, ensure all dependencies are compatible with that Java version:
  * If your policy is using custom connectors, see Custom Connectors Java Support to upgrade them.
  * If your policy uses extensions provided by Mule API Gateway, update the version of the dependency in your `pom.xml` file to a version that supports your new Java version.
For an example of how to use extensions in your custom policy, see HTTP Policy Transform Extension.
To find the first Java 17-compatible version of the extension, see the following table. All versions support Java 8:
Extension artifact ID |  First Java 17-compatible version  
---|---  
mule-client-id-enforcement-extension  
mule-cors-extension  
mule-event-authentication-extension  
mule-federation-extension  
mule-http-policy-transform-extension  
mule-http-proxy-extension  
mule-ip-filter-extension  
mule-json-threat-protection-extension  
mule-jwt-extension  
mule-rest-validator-extension  
mule-soap-fault  
mule-throttling-extension  
mule-tokenization-extension  
mule-wsdl-functions-extension  
mule-xml-threat-protection-extension  


## Configure the Java Version of Your Policy
For your policy to support different Java versions, you must modify the implementation metadata file to include the `supportedJavaVersions` field. The `supportedJavaVersions` supports the Java versions `8`, `11`, and `17`. If you do not include the `supportedJavaVersions` field, your policy supports only Java 8. As specified in Before You Begin, all policy dependencies must also support the listed Java versions.
For newer custom policies, your implementation metadata file and definition metadata file are split into two separate `YAML` files. However, for older policies, your implementation metadata file and definition metadata file might be included in the same `YAML` file. See the following sections the add the `supportedJavaVersions` to your relevant file structure:
  * Split Model Policies
  * Non-Split Model Policies


### Split Model Policies
For split model policies, add the `supportedJavaVersions` field to the implementation metadata `YAML`, for example:
```
#%Policy Implementation 1.0
name: Basic Authentication - Simple - Mule4
technology: mule4
supportedJavaVersions: ["8", "11", "17"]
minRuntimeVersion: 4.1.0
releaseNotes: |
 * Java 17 compatibility.
```

### Non-Split Model Policies
For older policies where implementation and definition metadata are found in the same `YAML` file, add the `supportedJavaVersions` field as follows:
```
id: basic-authentication-simple
name: Basic authentication - Simple
supportedPoliciesVersions: '>=v1'
description: Enforces HTTP Basic authentication according to the details configured in the policy.
category: Security
violationCategory: authentication
type: system
resourceLevelSupported: true
encryptionSupported: true
standalone: true
supportedJavaVersions: ["8", "11", "17"]
requiredCharacteristics: []
providedCharacteristics:
 - Requires authentication
configuration:
 - propertyName: username
  name: User Name
  type: string
  optional: false
  sensitive: false
  allowMultiple: false
 - propertyName: password
  name: User Password
  type: string
  optional: false
  sensitive: true
  allowMultiple: false
```

## See Also
  *   * Upgrading Java for Policies and API Proxies