Home >Database >Mysql Tutorial >How to Fix a 'JNI Error' in Eclipse on Windows 8.1 Due to Java Version Mismatch?

How to Fix a 'JNI Error' in Eclipse on Windows 8.1 Due to Java Version Mismatch?

Linda Hamilton
Linda HamiltonOriginal
2024-11-29 18:31:11768browse

How to Fix a

JNI Error in Eclipse on Windows 8.1

The error "A JNI error has occurred. Please check your installation and try again" often signifies a mismatch between the Java version used for compilation and execution. In this case, it appears that your program was compiled using Java JDK 12, but you're attempting to run it on a Java runtime environment (JRE) version 8.

Resolution:

To resolve this issue, follow these steps:

  1. Ensure that your Java Development Kit (JDK) and Java Runtime Environment (JRE) versions match. In this case, both should be version 12.
  2. Uninstall Java 8 JRE from your computer. This ensures that your command prompt environment is not confused about the Java version to use.
  3. Recompile your program using the correct Java version (CDK 12) by running the following command in the command prompt:

    javac -version
  4. Run your program using the same Java version:

    java -version

Once both the compilation and execution steps are using the same Java version, the JNI error should no longer occur.

The above is the detailed content of How to Fix a 'JNI Error' in Eclipse on Windows 8.1 Due to Java Version Mismatch?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn