JNI error : A class has been compiled by a more recent version of the Java Runtime

So, the problem is that you're compiling with javac from JDK 11, and then trying to run with Java 8. Since the java.exe from %JAVA_HOME%\bin is being picked up before C:\Program Files\Java\jdk-11.0.2\bin. And, I'm guessing it can't find javac because you added C:\Program Files\Java\jdk-11.0.2\bin to the path, without restarting your shell, which means the path is not reloaded.

To resolve this you should remove the C:\Program Files\Java\jdk-11.0.2\bin entry from the path, and then update the JAVA_HOME environment variable to point to C:\Program Files\Java\jdk-11.0.2 instead. Then restart your shell and it should pick up C:\Program Files\Java\jdk-11.0.2\bin expanded from %JAVA_HOME%\bin.

Tags:

Java