“Error: A JNI error has occurred, please check your installation …” – How to fix it!

“Error: A JNI error has occurred, please check your installation …” – How to fix it! Thumbnail

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.

Advertisement

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.

Advertisement

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.

Troubleshoot

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…”.

System Properties - Screenshot
System Properties – Screenshot

The “Enviroment Variables” window opens. There you select the variable “Path” in the lower window and click on “Edit…”.

Advertisement
Enviroment Variables - Screenshot
Enviroment Variables – Screenshot

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.

Edit enviroment variable - Screenshot
Edit enviroment variable – Screenshot

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! 🙂

Featured Posts
💬 Join the Conversation

30 Comments

  1. Pingback: My Homepage
  2. Tate Hayman says:

    Thank you so much for the help! It worked perfectly!

  3. Eglantine says:

    Hi, I started to do as you explained but when I select “Path” in the lower window of the environment variables, I can’t press any button : not edit, nor new, nor erase… But the upper window allows me to press those buttons. Could you please help me with this ?Thanks in advance

    1. LH says:

      Are you logged in as administrator? Maybe this is the problem…

  4. Majo says:

    Wow! It worked Thanks a lot!

  5. Aiden says:

    I dont understand the last step what do i have to do in command propmt

    1. LH says:

      For example, if your error occurred when running in CMD (e.g. java -jar test.jar), you can try again afterwards. If you had the error somewhere else you don’t need to do that of course.

  6. Breanna says:

    Hi, I got as far as the part where you look for the installation path of your JDK, and I didn’t see the entry so I clicked on new but it didn’t do anything. Then I clicked on the link that you put for if you haven’t installed the JDK, but I’m not sure what I’m supposed to download once I get there. Any help would be amazing, I have no clue what I’m doing but this tutorial was very easy to follow up until the point that I got lost so thank you!

    1. LH says:

      Hi, on this page is a link called “JDK Download” unter de “Oracle JDK” headline. You need to download and install this software. Hope this helps! 🙂

      1. Liam says:

        There is not link called JDK download

          1. Kat says:

            Hello! I’m stuck on this part too. Which download link is the one I need to get for Windows Java 8?

          2. LH says:

            Java 8 is already a bit older. So the JDK Download for this version should be here: http://jdk.java.net/java-se-ri/8-MR3

  7. Thunder_Cube says:

    ERRM Please help it won’t work it keeps saying it what do i do?

  8. defo says:

    thankyou bro, its work 100%

  9. suresh says:

    super…thank a lot bro…..

  10. Omer says:

    It worked, thank you!

  11. Bun says:

    Thank you so much, i’t’s been a headache for weeks, I’ve even reinstall but it didn’t work, until I saw your post, it worked , thank you

    1. LH says:

      You’re welcome

  12. Sohibnut says:

    Thank you! Thank you! Thank you! Thank you! Thank you! Thank you! Thank you! Thank you! Thank you! Thank you! Thank you! Thank you! Thank you! Thank you! Thank you! Thank you! Thank you! Thank you! Thank you! Thank you! Thank you! Thank you! Thank you! Thank you! Thank you! Thank you! Thank you! Thank you! Thank you! Thank you! Thank you! Thank you! Thank you! Thank you!

  13. a says:

    didnt fix it

  14. AN Subramanian says:

    Thank you. It worked and saved my time. Grateful.

    1. LH says:

      No problem. 🙂

    1. LH says:

      Thanks

  15. Abiola says:

    Many thanks!

    1. LH says:

      Gladly! 🙂

  16. Lalitha says:

    Thank you very much. It worked.

    1. LH says:

      I’m glad, thanks for the feedback! 🙂

Your email address will not be published. Required fields are marked *

bold italic underline strikeThrough
insertOrderedList insertUnorderedList outdent indent
removeFormat
createLink unlink
code