

What happens is that you build the code with Java 13 and 13 language level bytecode (target) and try to run it with Java 8 which is the first (default) Java version according to the PATH variable configuration. See also this answer for the Java class file versions. See this answer for the relevant screenshots.

If you want your code to run on lower JDK versions as well, change the target bytecode version in the IDE. It will also highlight invalid paths in red. Use this tool to quickly verify or edit the environment variables on Windows. Java.exe executable is in C:\Program Files\Java\jdk-13\bin directory, so that is what you need to have in PATH. Please make sure you have the bin subdirectory for the latest JDK version at the top of the PATH list. C:\Program Files\Java\jdk-13 you currently have there is not correct. You need to double check the PATH environment setting. I've set the path, tried to find a change in the Project structureĬOMPLETE ERROR MESSAGE: H:\087-JAVA\HelloWorld\src>java Įrror: A JNI error has occurred, please check your installation and try againĮxception in thread "main" : com/codewithmosh/Main has been compiled by a more recent version of the Java Runtime (class file version 57.0), this version of the Java Runtime only recognizes class file versions up to 52.0Īt 1(Native Method)Īt (Unknown Source)Īt (Unknown Source)Īt (Unknown Source)Īt $100(Unknown Source)Īt $1.run(Unknown Source)Īt (Native Method)Īt (Unknown Source)Īt (Unknown Source)Īt $AppClassLoader.loadClass(Unknown Source)Īt (Unknown Source) JAVA_HOME as: C:\Program Files\Java\jdk-13.Recognizes class file versions up to 52.0 (class file version 57.0), this version of the Java Runtime only has been compiled by a more recent version of the Java Runtime

But I have the newest version of everything newly installed on my system.
