Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows. ANTLR tools compiled to JRE 11 (class file 55), but installed JRE only recognizes up to JRE 8 (class file 52). #14

Open
rturrado opened this issue Aug 14, 2023 · 6 comments

Comments

@rturrado
Copy link

Hi,

I'm doing this both in Linux and Windows, and it's working fine in Linux but not in Windows:

  • Running python -m pip install --upgrade pip antlr4-tools, which installs antlr4-tools-0.2.
  • Running echo Y | antlr4, which downloads antlr4-4.13.0-complete.jar and runs OK in Linux but not in Windows.

The error is:

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

Shouldn't ANTLR tools be installing an adequate version of JRE?

Is there any easy way to fix this?

Many thanks!

@rturrado
Copy link
Author

BTW, it works OK for gcc-clang/Linux/x64, clang/MacOS/x64, and msvc/Windows/x64 if I go back to using antlr4-4.9.3. See here.

@rturrado
Copy link
Author

rturrado commented Aug 15, 2023 via email

@ericvergnaud
Copy link

ericvergnaud commented Aug 15, 2023 via email

@mawildoer
Copy link

mawildoer commented Nov 21, 2023

I've got a very similar issue for OSx (M3/aarch6):

(.venv) atopile % pip install antlr4-tools  
Collecting antlr4-tools
  Downloading antlr4_tools-0.2.1-py3-none-any.whl (4.3 kB)
Collecting install-jdk
  Downloading install_jdk-1.1.0-py3-none-any.whl (15 kB)
Installing collected packages: install-jdk, antlr4-tools
Successfully installed antlr4-tools-0.2.1 install-jdk-1.1.0

[notice] A new release of pip is available: 23.0.1 -> 23.3.1
[notice] To update, run: pip install --upgrade pip
(.venv) atopile % antlr4
Downloading antlr4-4.13.1-complete.jar
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
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:473)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:359)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
        at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:635)

It's also not the first time I've experienced this. I'm not sure I'm familiar enough in Java to work this out. I've tried installing other versions of and upgrading Java as well. Following along here!

This was the issue that originally spurred me on to create this dockerised version of the tool: antlr/antlr4#4244

I see now it was actually approved - I missed that all this time ago! I'll have to polish it off as well

@parrt
Copy link
Member

parrt commented Nov 21, 2023

It's weird. It's like it's installing an old version of java.

@mawildoer
Copy link

I have a hunch this has something to do with Rosetta on OSx. I tried disabling it, installing native (aarch64) Java (via native brew) with success.

I'm not sure it's worth getting to the bottom of, but hopefully the breadcrumbs at least help the next person to hit this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants