You encountered this error message? Don’t panic! You have solved the problem with a simple and fast hand trick. And here you can learn how to do it.
If you have encountered this (or a similar) error message the problem is quickly solved.
“Error: A JNI error has occurred, please check your installation and try again
Exception in thread “main” java.lang.UnsupportedClassVersionError: Main has been compiled by a more recent version of the Java Runtime (class file version 56.0), this version of the Java Runtime only recognizes class file versions up to 52.0″
The problem occurs because your JRE (Java Runtime Enviroment) and your JDK (Java Development Kit) are not working together correctly.
Often the problem appears if you want to call a .jar file via command line, e.g. via the command
java -jar File.jar or if you have compiled your program with Eclipse before.
If you want to learn more about Java, check out this book*:
To fix the bug, you only need to adjust the environment variables for Java.
To do this, you navigate by typing “env” in your Windows search and open the item “Editing System Environment Variables”. In this window click on “Environment Variables…”.
The “Enviroment Variables” window opens. There you select the variable “Path” in the lower window and click on “Edit…”.
There you look for the line where the installation path of your JDK is stored. In this case it is under C:\Program Files\Java\jdk-13.0.1\bin.
If you do not have this entry in your database, you can add it by clicking the “New” button. If you have not yet installed the JDK, you can do so here.
When you have found the line, click on “Move Up” until the entry is at the top of the list. Done!
Now you have to close and reopen the Windows CMD once and the error should be fixed. I hope this post could solve your problem! 🙂