3

When double-clicking on mule.bat I get the following error message.

Error message:

Caught: BUG! exception in phase 'semantic analysis' in source unit 'C:\NihaMule\mule-ee-distribution-standalone-4.4.0\mule-enterprise-standalone-4.4.0\bin\additional.groovy' Unsupported class file major version 61
aled
  • 21,330
  • 3
  • 27
  • 34

4 Answers4

2

Class file Major version - 61 , that means your system have JDK 17 ( latest Java version).

  1. Kindly install JDK 11 to be compatible with Mule

  2. Update the JAVA_HOME windows environment variable

  3. Update the PATH windows environment variable.

Run mule.bat

kus
  • 446
  • 3
  • 7
  • I had a look at the Mule forums, but you pointed me in the correct direction. I switch between IDE's often depending on my work and boy oh boy, Anystudio makes you go through hoops... I submitted my answer here and on the forums. – Paul Jan 17 '23 at 13:54
  • Mule 4.4 is also compatible with Java 8. – aled Feb 01 '23 at 18:27
1

You seem to be using an incompatible Java version to start Mule.

If you are using Mule standalone, either use a compatible Java version and set it first in the operating system PATH environment variable, or alternatively configure the full path of the Java executable in the configuration file wrapper.conf (example: wrapper.java.command=<Java Home>/bin/java).

Note that compatible Java versions for Mule 4.3/4.4 are JDK 8 or JDK 11 only. Any other Java/OpenJDK versions are not supported.

If you are using Anypoint Studio select a supported version for your Mule projects.

aled
  • 21,330
  • 3
  • 27
  • 34
1

As a developer in need of several Java jdk's (or at least the latest LTS), I need a different approach. Firstly, you need to know that Anystudio only works with jdk8 (pre-installed), or jdk11 (configurable). You can forget about the rest. Secondly, being a derivative from Eclipse, your JAVA_HOME needs to point towards the correct jdk or you'll get the afformentioned error where the 61 means the user had jdk17 configured.

STEPS TO CONFIGURE JDK 11 (for Anypoint v7.14.0)

  • right click on your project
  • go to "Run As" and select "Mule Application (configure). A new window opens.
  • In that window you'll see multiple tabs. Select "JRE"
  • Choose "Alternate JRE" and click on the "Installed JRE's" button. A new window opens
  • In that window you'll see an "Add..." button. Select "Standard VM", click "Next >"
  • Choose your jdk directory. Click "Finish" and select your jdk from the dropdown.

Alternatively:

  • locate your AnypointStudio.ini file and configure your -vm option described here, or in code:
-vm
C:\Program Files\Java\jdk-11.0.4\bin\javaw.exe

There are a few alternatives when configuring the Anystudio.ini file, so if the change above doesn't work, search the Mule forums for the latest info on Configure studio to use your own jdk.

  • Go to your configuration and choose "Execution environment" instead of Alternate JRE. Though make sure that it points to CDC-1.0/Foundation-1.0 (your_jdk_version)

This should work when your JAVA_HOME points to the correct jdk. If, like me, you need to switch to other versions, it can be bothersome to constantly change it manually. For this, I created .bat-files which I execute before starting up Anystudio. Make sure that your computer's path references JAVA_HOME instead of a hardcoded path. Otherwise the steps below won't be enough.

CREATING .BAT-FILES TO PROGRAMMATICLY CHANGE YOUR JAVA_HOME (for Windows 11)

  • Open notepad
  • type the following, keeping in mind to change the jdk to your personal path/version:
setx /M JAVA_HOME "C:\Program Files\Java\jdk-11.0.4"
  • Save file with your_file_name.bat as "All files"
  • Create a shortcut from your bat-file
  • Right-mouse click on the shortcut and go to "Properties". A new window opens
  • In the window that opened, go to "Advanced"
  • Select "Run as administrator", click "Ok", click "Apply"

Keep in mind, you'll need 2 of those .bat-files. One for downgrading your JAVA_HOME (execute before opening Anystudio) and one for restoring it (execute it after you're done working in Anystudio). Both system settings and commandlines don't show a changed JAVA_HOME path directly. close/reopen them to see that the changes have been applied.

Paul
  • 841
  • 13
  • 20
  • The question is about running Mule Runtime standalone, not Studio or Mule inside Studio. In any case Studio 7.x includes an OpenJDK 11 installation to run Studio and an OpenJDK 8 to execute Mule projects by default. – aled Feb 01 '23 at 18:26
0

Removing the the other java installations from c:\program files\java (for windows), solved for me.

I didn't have any environment variables pointing to any specific java installation what makes it odd how AnyPoint studio was using those installations.  

I'm running on a windows 11 workstation.

Note: some posts advise to change mule runtime version to 4.2.x, but that will break some functionalities, like database connector. In my case the mule services become very unstable when some features like that were added to the project.

MiguelSlv
  • 14,067
  • 15
  • 102
  • 169