I was trying to compile and run a java file using command prompt, first used "javac main.java" then ran the class file with "java main"
Upon running the class file, I'm hit with an error:
"Error: A JNI error has occurred, please check your installation and try again Exception in thread "main" java.lang.UnsupportedClassVersionError: main has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 52.0"
I then found this possible solution, and updated my User Variables "Path" to jdk17.0.1\bin, and my System Variables "Path" to jre1.8.0_311\bin. I was a bit confused on which Path I was to updated/change so I just updated both...? Not sure if this was the correct thing to do.
In addition, both java -version and javac -version output the latest version "17.0.1" and "jre1.8.0_311". java -version and javac -version :
Error Message :
What confuses me is that running code in eclipse works fine, so I'm not quite sure that it's an issue with Path so I'm not sure what the issue is.