2

I've just started installing ANTLR on my Windows PC and have run into a problem.

I installed Java as part of this (file JavaSetup8u341.exe, the latest, it would appear), but when I run the first test of the installation with java org.antlr.v4.Tool, I get the following error:

Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/antlr/v4/Tool has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0

The Java control panel tells me that I have the latest version (platform version 1.8; the instructions suggest anything above 1.7).

I'm at a loss as to what to do next.

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
  • 2
    See https://github.com/antlr/antlr4/releases. "Going forward, we are using Java 11 for the source code and the compiled .class files for the ANTLR tool. The Java runtime target, however, and the associated runtime tests use Java 8 (bumping up from Java 7)." You need at least v11 to run the tool. You may as well "install" v18. And, "install" is a loose term. Just download the openjdk .zip file and decompress it. Then adjust PATH to point to the bin/ directory in that decompressed directory. – kaby76 Aug 24 '22 at 16:13
  • 2
    For the record, Java 8 is not the latest version. The latest is Java 18 and Java 19 is due in a month ... – Stephen C Aug 24 '22 at 16:33
  • Thanks. I saw 17 there, installed that, seems to do the trick. – Karljürgen Feuerherm Aug 24 '22 at 16:48

1 Answers1

0

class suprt bit 55 mean Java SE 11, but you have 52 mean Java SE 8, you need upgrade you JRE to at least 11.

on windows, you can download from https://learn.microsoft.com/en-us/java/openjdk/download

about class suprt bit, see https://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html

arli weng
  • 51
  • 1