R2017a - Unsupported major.minor version 52.0

13 vues (au cours des 30 derniers jours)
Paolo
Paolo le 26 Avr 2018
Commenté : line hammer le 18 Mai 2021
Hello, I've just imported an external jar in MATLAB R2018a and it works correctly, but if I am going to import same exernal jar into R2017a I have the following error
...Unsupported major.minor version 52.0
Does it means that the java compiler in R2017a is different that used to compile the external jar function ? If not, what could be the reason of the above error?
Thank you Best Regards Paolo
  1 commentaire
line hammer
line hammer le 18 Mai 2021
Unsupported major.minor version error is because of Java version mismatch. It happens when you compile your projects on higher version of java(e.g. jdk 1.8) and then run it on a lower version (e.g. jdk 1.7). Depending on your situation, you have two ways to resolve this error: compile your code for an earlier version of Java, or run your code on a newer Java version. Sometimes you may have more than one version of Java SDK installed in your machine. Make sure the application you are running is pointing to the right or highest version available . It is better you need to install both JRE/JDK with the same version.

Connectez-vous pour commenter.

Réponses (1)

Yair Altman
Yair Altman le 22 Déc 2018
Modifié(e) : Yair Altman le 23 Déc 2018
52.0 indicates Java classes compiled with JDK 8 - These classes can only be run under Java 8 or newer. Until R2017a Matlab integrated Java 7, which cannot run such classes. Java 8 was only included in Matlab in the R2017b release. This means that to run your classes in Matlab you'd need to do one of the following:
  1. Retrofit your Matlab R2017a installation to use Java 8 or newer (details)
  2. Use R2017b or newer instead of R2017a
  3. Recompile the Java classes using JDK 7 or older
Yair Altman

Catégories

En savoir plus sur Call Java from MATLAB dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by