0

According to an old question about How to fix java.lang.UnsupportedClassVersionError...

The fix is to update my JRE, and my PATH variable, so they point to the latest JRE and JDK... I've done that...

I'm at JRE 8 version 211, apparently the latest, with the latest JDK, JDK 12...

So why is "java" saying that my Java Runtime can only run on class files up on "version 52", while my class files are compiled with that JDK, are "class file version 56"?

Since everything's the latest version, shouldn't that mean that I can run what I compile?

Malady
  • 229
  • 1
  • 12
  • Latest Java is 12, I think. Though it's a bit unusual that you have a class format that isn't backwards compatible. What are you actually trying to run? – markspace May 26 '19 at 15:05
  • 1
    It appears you are compiling using JDK 12, while running with JRE 8. This is definitely not going to work out right. Try executing `java -version` to see what you are actually running. If you see something like java version "1.8.0_211" then you need to fix your environment variables, by making PATH, JAVA_HOME point to your JDK installation instead of JRE 8 installation. – glee8e May 26 '19 at 15:07
  • Let that sink in: you say it yourself: your JDK which COMPILES things is 12. Your runtime is 8. And you are surprised that something compiled WITH 12 ... doesnt work on 8? – GhostCat May 26 '19 at 15:15
  • And note: that duplicate doesn't at all say that you should use the LATEST JDK with an older JRE. It rather tells you how to get to a combination of JDK and JRE that work together. Get yourself a JDK 8, or compile using the -target switch as necessary! – GhostCat May 26 '19 at 15:16

0 Answers0