Contact Us 1-800-596-4880

Java Version Support

Specify the Java compatibility of your custom module. In Mule 4.5.0 and later, custom modules that do not specify the Java compatibility are assumed to be compatible with Java 8 and Java 11 only. If your custom module is compatible with Java 17, you must specify the Java compatibility to include Java 17.

Communicating the Java compatibility of your custom module also ensures:

  • Safe upgrades

    Users can determine whether their Mule applications can safely upgrade to Java 17, ensuring a smooth transition and avoiding potential issues.

  • User experience

    Providing clear information about Java compatibilty enhances the user experience, especially for Anypoint Exchange users who rely on this information for selecting modules.

Specify Java Compatibility

To specify Java compatibility of your custom module:

  1. Generate metadata to specify Java compatibility of your custom module by adding or upgrading the custom connector mule-sdk-api dependency to the latest version, for example:

    <dependency>
       <groupId>org.mule.sdk</groupId>
       <artifactId>mule-sdk-api</artifactId>
       <version>0.7.0</version>
    </dependency>
  2. Add the @JavaVersionSupport annotation in the same class as the @Extension annotation and include the supported Java versions as values, for example:

    @Extension(name = "Database")
    @Operations(...)
    @JavaVersionSupport({JAVA_8, JAVA_11, JAVA_17})
    public class DatabaseConnector {
    ..
    }

You can mark your custom connector as compatible with Java 17 only; however, you must ensure that no adoption or backward compatibility issues exist.

When you deploy a Mule app, Mule verifies that all modules in the Mule app are compatible with the Java version. If Mule finds an incompatibility, Mule throws an error and the application does not deploy.

If your code is compatible with Java 17 but you do not declare Java 17 compatibility, you can still get a successful test run (only when running a test on Java 8).