This error arises A JNI error has occurred please check your installation and try again” in CMD. while you have just installed java in your system and haven’t configured its path properly, you might get this error. A JNI error has occurred please check your installation and try again” in CMD.
You should follow the exact same steps mentioned here in order to install and configure java without any errors.
Why this error happens? A JNI error has occurred please check your installation and try again” in CMD
You are facing this error, because you’ve recently installed java and your jdk and java run time environment are not of same versions. While this happens, some versions compiles java in some way and other version compile java code in some other way. So this error arises because of versions incompatibility.
Now that your versions are different, you need to play a trick in order to make them compatible with each other.
So in this walk through, i will give you a trick to resolve this error.
Trick to solve this error:
In order to overcome this error, Here is a simple trick.
I am assuming that you’ve set environment variables in your system but this error is arising while running java through CMD.
So right click of this PC and click on properties.
Right there click on Advanced system settings.
click on environment variables and know here is the trick.
Under system variables click on path and hit edit.
On this screen, click on your jdk location variable and press move up button until it reach to top of other variables. Now click on OK and press OK on all the previous windows that are opened.
Done! Now run and check if it is working or not?
Once you’ve done that open up CMD and compile your java program and run java through CMD.
Wants to check out a video guide on this tutorial, click here.
I hope your problem is solved, if your problem doesn’t solved then feel free to leave a comment and i will help you to resolve it. Happy Coding!