Error “A JNI error has occurred. Please check your installation and try again in Eclipse x86 Windows 8.1”

I have been having this problem for a while, but now I have figured it out.

It turns out that Java JDK 12 has both the JRE and the JDK inside the bin folder of the Java 12 JDK. (I have always believed that JRE and JDK are different application, but it turns out things have changed.)

My problem was that I had Java JDK 12 installed on my computer. At the same time, I had Java 8 (JRE) Installed on my computer. So my computer was getting confused.

With my command prompt environment set up to run Java and Javac commands:

I typed the follow commands:

java -version

This gave me Java 8.

After that, I typed:

javac -version

This gave me Java 12.

In other words, my program is getting compiled with Java 12 and I am trying to run with Java 8.

To solve the problem, I uninstalled Java 8 JRE from my computer.

I went back to command prompt to check if “java -version” and “javac -version” was returning the same version number, and yes, it was returning Java 12.

I tried recompiling my program again, and running it. It worked!!

Leave a Comment