Selecting a Different Java Version to Run the Embedded Mule Runtime Engine
You can select any of your installed JREs as the default Java runtime environment that Studio uses to run your Mule project.
You can select the version of the JDK to use for the project that is compatible with the Mule runtime version the project runs on.
Learn more about compatible versions of Java at Anypoint Studio Release Notes.
Select the Java Version for All Your Studio Projects
-
In Studio, click Anypoint Studio, and Preferences.
-
Under Java, Installed JREs, select the JRE version to use.
If your installed JRE version doesn’t appear, you must configure it:
-
Go to Add and select your installed JRE type:
-
MacOS X VM
for MacOS. -
Standard VM
for MacOS, Windows, and Linux.
-
-
Click Next.
-
In JRE Home, click Directory and select the folder where you have installed JRE.
For example,/Library/Java/JavaVirtualMachines/jdk-11.0.3.jdk/Contents/Home
-
In JRE Name type in a descriptive name for the JRE.
For example,Java SE 11
. -
Click Finish.
-
Migrate Your Project to a Different Java Version
Studio 7.17.0 and later are compatible with Java 17, so you can upgrade modules and apps in your projects to obtain its latest features.
-
Right-click on your Studio project.
-
Navigate to Build Path, and click Configure Build Path.
-
In the Libraries tab, select your JRE System Library and click Edit.
-
Select the Alternate JRE option, and select your desired JRE from the drop-down menu.
If you select Java 17 for your project, Studio automatically searches Exchange and suggests the modules and connectors to upgrade to make your app compatible with Java 17.
If you find issues, you can troubleshoot them and then deploy your project to the appropriate environment with Java compatibility checks.
Verify Java 17 Tooling
In Studio 7.19.0 and later, your new Mule projects use JDK 17 by default and the bundled modules in your Mule projects must be Java 17 compatible. If you have issues with the modules that use previous versions of Java:
-
Go to Settings > Anypoint Studio > Tooling.
-
In the Life cycle section, select Java 17 as the Java virtual machine for Studio services.
-
Click Apply and Close.
The Studio services restart and the tooling instance restarts using Java 17.
To ensure your modules are Java 17 compatible, use the Java 17 module compatibility tool.
Verify Java 17 Module Compatibility
In Studio 7.19.0 and later, you can check if the modules in your Mule project are Java 17 compatible:
-
Right-click on the name of your project.
-
Select Mule > Java 17 Module Compatibility.
Studio analyzes the modules in your Mule project and shows the modules that aren’t Java 17 compatible in the Problems tab.
-
Update the modules that aren’t Java 17 compatible.