java.lang.UnsupportedClassVersionError when compiling applications in Eclipse

3
Hi, I’ve received the following error multiple times across different Mendix projects when attempting to debug or compile my applications in Eclipse. Exception in thread "main" java.lang.UnsupportedClassVersionError: system/UserActionsRegistrar has been compiled by a more recent version of the Java Runtime (class file version 57.0), this version of the Java Runtime only recognizes class file versions up to 52.0 How do I work around this?
asked
3 answers
4

The error above is saying that the system/UserActionsRegistrar file has been compiled by Java 13 (supports class file version 57.0) and you’re attempting to compile with an older JRE, in this case Java 8 (supports class file version 52.0).

To resolve the issue:

  1. Open your project in the Modeler
  2. In the modeler click Edit > Preferences and note down the JDK directory field
  3. In the modeler click Project > Clean Deployment Directory
  4. In the modeler click Project > Deploy for Eclipse
  5. Import the project or refresh the imported project in Eclipse
  6. Click the root directory of the project to select it and click Window > Preferences > Java > Installed JREs
  7. Click the checkbox next to the JRE from step 2. Note: If the JRE from step 2 isn’t listed, import it by clicking Add and pointing to the same directory from step 2.
  8. Click Apply and Close

 

The above will tell Eclipse to compile the project the same JRE that is being used by the modeler.

 

If you still run into the issue, you may need to change the Eclipse Compiler Compliance Level. Simple instructions on how to do that can be found on this post.

 

answered
1

This happens when the JDK used to compile the app is different that what Studio Pro (or that version of Mendix) expects.

 

Mendix 7 uses Java 8

Mendix 8 uses Java 11

 

Based on the error, it looks like you are using v57, which is Java 13. (Reference)

To fix it, try this guide or Google for “eclipse change JRE” or “eclipse change JDK”.

answered
1

This usually happens if you have Eclipse set to auto compile, and the version of Java you are using is later than the version Mendix is expecting. 

Mendix 7 uses Java 8, and your Eclipse is using Java 13.

To fix this, disable the automatic compilation functionality in Eclipse, and instead let Mendix build the Java actions as part of its build process.

Hope this helps.

answered