Downloading Java 18

Viewed 32

After trying to redownload Java 18 to test something out, my project keeps on giving me this error:

Exception in thread "main" java.lang.UnsupportedClassVersionError: main/Main has been compiled by a more recent version of the Java Runtime (class file version 62.0), this version of the Java Runtime only recognizes class file versions up to 52.0 ...

I found that this is because version 52.0 is Java 8 and 62.0 is Java 18, and that my compiler is too high of a version/my loader is too low of a version. I keep on trying every way to download Java 18, and that works fine, the installation and all, but when I type java -version into the console or reopen my project, I get that my version of Java is at 8 instead of 18.

java version "1.8.0_341"
Java(TM) SE Runtime Environment (build 1.8.0_341-b10)
Java HotSpot(TM) 64-Bit Server VM (build 25.341-b10, mixed mode)

Is Java 18 either not installing or is my computer preferring Java 8 over it?

I have a Mac.

0 Answers
Related